public final class ASTHelper extends Object
| Modifier and Type | Field and Description | 
|---|---|
| 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 | 
| Modifier and Type | Method and Description | 
|---|---|
| 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  NameExprfrom 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  ReferenceTypefor the given primitive type. | 
| static ReferenceType | createReferenceType(String name,
                   int arrayCount)Creates a new  ReferenceTypefor a class or interface. | 
| static VariableDeclarationExpr | createVariableDeclarationExpr(Type type,
                             String name)Creates a  VariableDeclarationExpr. | 
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
public static NameExpr createNameExpr(String qualifiedName)
NameExpr from a qualified name.qualifiedName - qualified nameNameExprpublic static Parameter createParameter(Type type, String name)
Parameter.type - type of the parametername - name of the parameterParameterpublic static FieldDeclaration createFieldDeclaration(int modifiers, Type type, VariableDeclarator variable)
FieldDeclaration.modifiers - modifierstype - typevariable - variable declaratorFieldDeclarationpublic static FieldDeclaration createFieldDeclaration(int modifiers, Type type, String name)
FieldDeclaration.modifiers - modifierstype - typename - field nameFieldDeclarationpublic static VariableDeclarationExpr createVariableDeclarationExpr(Type type, String name)
VariableDeclarationExpr.type - typename - nameVariableDeclarationExprpublic static void addParameter(MethodDeclaration method, Parameter parameter)
null.method - methodparameter - parameterpublic static void addArgument(MethodCallExpr call, Expression arg)
null.call - method callarg - argument valuepublic static void addTypeDeclaration(CompilationUnit cu, TypeDeclaration type)
null.cu - compilation unittype - type declarationpublic 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.ReferenceTypepublic 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.ReferenceTypepublic static void addStmt(BlockStmt block, Statement stmt)
null.public static void addStmt(BlockStmt block, Expression expr)
null.public static void addMember(TypeDeclaration type, BodyDeclaration decl)
null.type - type declarationdecl - member declaration