|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.github.antlrjavaparser.ASTHelper
public final class ASTHelper
This class helps to construct new nodes.
| Field Summary | |
|---|---|
static PrimitiveType |
BOOLEAN_TYPE
|
static PrimitiveType |
BYTE_TYPE
|
static PrimitiveType |
CHAR_TYPE
|
static PrimitiveType |
DOUBLE_TYPE
|
static PrimitiveType |
FLOAT_TYPE
|
static PrimitiveType |
INT_TYPE
|
static PrimitiveType |
LONG_TYPE
|
static PrimitiveType |
SHORT_TYPE
|
static VoidType |
VOID_TYPE
|
| Method Summary | |
|---|---|
static void |
addArgument(MethodCallExpr call,
Expression arg)
Adds the given argument to the method call. |
static void |
addMember(TypeDeclaration type,
BodyDeclaration decl)
Adds the given declaration to the specified type. |
static void |
addParameter(MethodDeclaration method,
Parameter parameter)
Adds the given parameter to the method. |
static void |
addStmt(BlockStmt block,
Expression expr)
Adds the given expression to the specified block. |
static void |
addStmt(BlockStmt block,
Statement stmt)
Adds the given statement to the specified block. |
static void |
addTypeDeclaration(CompilationUnit cu,
TypeDeclaration type)
Adds the given type declaration to the compilation unit. |
static FieldDeclaration |
createFieldDeclaration(int modifiers,
Type type,
String name)
Creates a FieldDeclaration. |
static FieldDeclaration |
createFieldDeclaration(int modifiers,
Type type,
VariableDeclarator variable)
Creates a FieldDeclaration. |
static NameExpr |
createNameExpr(String qualifiedName)
Creates a new NameExpr from a qualified name.The qualified name can contains "." (dot) characters. |
static Parameter |
createParameter(Type type,
String name)
Creates a new Parameter. |
static ReferenceType |
createReferenceType(PrimitiveType type,
int arrayCount)
Creates a new ReferenceType for the given primitive type. |
static ReferenceType |
createReferenceType(String name,
int arrayCount)
Creates a new ReferenceType for a class or interface. |
static VariableDeclarationExpr |
createVariableDeclarationExpr(Type type,
String name)
Creates a VariableDeclarationExpr. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final PrimitiveType BYTE_TYPE
public static final PrimitiveType SHORT_TYPE
public static final PrimitiveType INT_TYPE
public static final PrimitiveType LONG_TYPE
public static final PrimitiveType FLOAT_TYPE
public static final PrimitiveType DOUBLE_TYPE
public static final PrimitiveType BOOLEAN_TYPE
public static final PrimitiveType CHAR_TYPE
public static final VoidType VOID_TYPE
| Method Detail |
|---|
public static NameExpr createNameExpr(String qualifiedName)
NameExpr from a qualified name.
qualifiedName - qualified name
NameExpr
public static Parameter createParameter(Type type,
String name)
Parameter.
type - type of the parametername - name of the parameter
Parameter
public static FieldDeclaration createFieldDeclaration(int modifiers,
Type type,
VariableDeclarator variable)
FieldDeclaration.
modifiers - modifierstype - typevariable - variable declarator
FieldDeclaration
public static FieldDeclaration createFieldDeclaration(int modifiers,
Type type,
String name)
FieldDeclaration.
modifiers - modifierstype - typename - field name
FieldDeclaration
public static VariableDeclarationExpr createVariableDeclarationExpr(Type type,
String name)
VariableDeclarationExpr.
type - typename - name
VariableDeclarationExpr
public static void addParameter(MethodDeclaration method,
Parameter parameter)
null.
method - methodparameter - parameter
public static void addArgument(MethodCallExpr call,
Expression arg)
null.
call - method callarg - argument value
public static void addTypeDeclaration(CompilationUnit cu,
TypeDeclaration type)
null.
cu - compilation unittype - type declaration
public static ReferenceType createReferenceType(String name,
int arrayCount)
ReferenceType for a class or interface.
name - name of the class or interfacearrayCount - number os arrays or 0 if is not a array.
ReferenceType
public static ReferenceType createReferenceType(PrimitiveType type,
int arrayCount)
ReferenceType for the given primitive type.
type - primitive typearrayCount - number os arrays or 0 if is not a array.
ReferenceType
public static void addStmt(BlockStmt block,
Statement stmt)
null.
block - stmt -
public static void addStmt(BlockStmt block,
Expression expr)
null.
block - expr -
public static void addMember(TypeDeclaration type,
BodyDeclaration decl)
null.
type - type declarationdecl - member declaration
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||