lombok.ast
Class Template<T extends Node>
java.lang.Object
lombok.ast.Template<T>
public class Template<T extends Node>
- extends Object
Method Summary |
T |
finish()
|
static
|
of(N source)
NB: Do not simply pass the result of parseX to this method; parsing is extremely slow. |
static ConstructorDeclaration |
parseConstructor(String source)
|
static Expression |
parseExpression(String source)
|
static VariableDeclaration |
parseField(String source)
|
static TypeMember |
parseMember(String source)
Parses one construct that is legal as a type member, and returns it. |
static MethodDeclaration |
parseMethod(String source)
|
static Statement |
parseStatement(String source)
|
static VariableDefinition |
parseVariableDefinition(String source)
|
Template<T> |
replaceExpression(String placeholder,
Node replacement)
|
Template<T> |
replaceExpression(String placeholder,
Node replacement,
Position p)
|
Template<T> |
replaceIdentifier(String placeholder,
String replacement)
|
Template<T> |
replaceIdentifier(String placeholder,
String replacement,
Position p)
|
Template<T> |
replaceStatement(String placeholder,
List<? extends Node> replacement)
|
Template<T> |
replaceStatement(String placeholder,
List<? extends Node> replacement,
Position p)
|
Template<T> |
replaceStatement(String placeholder,
Node replacement)
|
Template<T> |
replaceStatement(String placeholder,
Node replacement,
Position p)
|
Template<T> |
replaceTypeReference(String placeholder,
Node replacement)
|
Template<T> |
replaceTypeReference(String placeholder,
Node replacement,
Position p)
|
Template<T> |
setResponsibleNode(Node responsible)
|
Template<T> |
setStartPosition(int location)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
parseMember
public static TypeMember parseMember(String source)
throws AstException
- Parses one construct that is legal as a type member, and returns it.
Legal type members:
- Constructor Declaration
- Method Declaration
- Static or Instance Initializer
- Any type declaration
- The empty declaration (lone semi-colon)
- A variable declaration
Note that neither annotation method declarations nor enum constants will be parsed properly by this method.
- Throws:
AstException
parseMethod
public static MethodDeclaration parseMethod(String source)
throws AstException
- Throws:
AstException
parseConstructor
public static ConstructorDeclaration parseConstructor(String source)
throws AstException
- Throws:
AstException
parseField
public static VariableDeclaration parseField(String source)
throws AstException
- Throws:
AstException
parseVariableDefinition
public static VariableDefinition parseVariableDefinition(String source)
throws AstException
- Throws:
AstException
parseStatement
public static Statement parseStatement(String source)
throws AstException
- Throws:
AstException
parseExpression
public static Expression parseExpression(String source)
throws AstException
- Throws:
AstException
of
public static <N extends Node> Template<N> of(N source)
throws AstException
- NB: Do not simply pass the result of
parseX
to this method; parsing is extremely slow. Instead, parse a template once,
and then pass this one result every time. The template will never modify the original.
- Throws:
AstException
setStartPosition
public Template<T> setStartPosition(int location)
setResponsibleNode
public Template<T> setResponsibleNode(Node responsible)
replaceIdentifier
public Template<T> replaceIdentifier(String placeholder,
String replacement,
Position p)
replaceIdentifier
public Template<T> replaceIdentifier(String placeholder,
String replacement)
replaceStatement
public Template<T> replaceStatement(String placeholder,
Node replacement,
Position p)
replaceStatement
public Template<T> replaceStatement(String placeholder,
Node replacement)
replaceStatement
public Template<T> replaceStatement(String placeholder,
List<? extends Node> replacement,
Position p)
replaceStatement
public Template<T> replaceStatement(String placeholder,
List<? extends Node> replacement)
replaceExpression
public Template<T> replaceExpression(String placeholder,
Node replacement,
Position p)
replaceExpression
public Template<T> replaceExpression(String placeholder,
Node replacement)
replaceTypeReference
public Template<T> replaceTypeReference(String placeholder,
Node replacement,
Position p)
replaceTypeReference
public Template<T> replaceTypeReference(String placeholder,
Node replacement)
finish
public T finish()
Copyright © 2010-2011 The Project Lombok Authors, licensed under the MIT licence.