public class ClassBuilder extends Object
| Constructor and Description |
|---|
ClassBuilder(org.eclipse.jdt.core.dom.AnonymousClassDeclaration clas,
ClassBuilder outer)
Constructor for an anonymous inner class.
|
| Modifier and Type | Method and Description |
|---|---|
MethodBuilder |
addConstructor(String name)
Add constructor declaration.
|
void |
addEnumConstant(String value,
String doc)
Add a constant to a Java 5 enum definition.
|
void |
addEnumConstant(String name,
String doc,
String value)
Add a constant to a Java 5 enum definition.
|
void |
addField(org.eclipse.jdt.core.dom.FieldDeclaration field)
Add separately-constructed field declaration.
|
FieldBuilder |
addField(String name,
String type)
Add field declaration.
|
FieldBuilder |
addField(String name,
org.eclipse.jdt.core.dom.Type type)
Add field declaration.
|
void |
addInterface(String type)
Add an interface to this class definition.
|
FieldBuilder |
addIntField(String name,
String value)
Add
int field declaration with constant initialization. |
void |
addJavaDoc(String doc,
org.eclipse.jdt.core.dom.BodyDeclaration decl)
Add JavaDoc to a declaration.
|
void |
addMethod(org.eclipse.jdt.core.dom.MethodDeclaration method)
Add separately-constructed method declaration.
|
MethodBuilder |
addMethod(String name,
String type)
Add method declaration.
|
MethodBuilder |
addMethod(String name,
org.eclipse.jdt.core.dom.Type type)
Add method declaration.
|
void |
addSourceComment(String text)
Set source comment for this class.
|
void |
addType(org.eclipse.jdt.core.dom.TypeDeclaration type)
Add separately-constructed inner class declaration.
|
ArrayAccessBuilder |
buildArrayIndexAccess(String aname,
String iname)
Build array access expression for a named array variable and named index variable.
|
CastBuilder |
buildCast(String type)
Build a cast expression.
|
CastBuilder |
buildCast(org.eclipse.jdt.core.dom.Type type)
Build a cast expression.
|
InfixExpressionBuilder |
buildInfix(org.eclipse.jdt.core.dom.InfixExpression.Operator op)
Build general infix expression.
|
InfixExpressionBuilder |
buildNameOp(String name,
org.eclipse.jdt.core.dom.InfixExpression.Operator op)
Build infix expression involving a local variable or field name as the left operand.
|
PrefixExpressionBuilder |
buildPreincrement(String name)
Build a preincrement expression using a local variable or field name as the operand.
|
InfixExpressionBuilder |
buildStringConcatenation(String text)
Build a string concatenation expression starting from from a string literal.
|
org.eclipse.jdt.core.dom.ASTNode |
clone(org.eclipse.jdt.core.dom.ASTNode node)
Clone an AST node.
|
InvocationBuilder |
createExpressionMethodCall(ExpressionBuilderBase expr,
String mname)
Create method call builder on the reference result of an expression.
|
InvocationBuilder |
createLocalStaticMethodCall(String mname)
Create internal static method call builder.
|
InvocationBuilder |
createMemberMethodCall(String mname)
Create internal member method call builder.
|
InvocationBuilder |
createNormalMethodCall(String name,
String mname)
Create method call builder on a local variable or field value.
|
org.eclipse.jdt.core.dom.Type |
createParameterizedType(String type,
String param)
Create a parameterized type.
|
org.eclipse.jdt.core.dom.Type |
createParameterizedType(String type,
org.eclipse.jdt.core.dom.Type param)
Create a parameterized type.
|
InvocationBuilder |
createStaticMethodCall(String fname)
Create a static method call builder.
|
InvocationBuilder |
createStaticMethodCall(String cname,
String mname)
Create a static method call builder.
|
org.eclipse.jdt.core.dom.Type |
createType(String type)
Create type definition.
|
void |
finish()
Finish building the source file data structures.
|
org.eclipse.jdt.core.dom.FieldDeclaration[] |
getFields()
Get the fields defined in this class.
|
String[] |
getInterfaces()
Get the interfaces implemented by this class.
|
org.eclipse.jdt.core.dom.MethodDeclaration[] |
getMethods()
Get the methods defined in this class.
|
StringPair[] |
getSortedFields()
Get a sorted array of the field names and types defined in this class.
|
NewArrayBuilder |
newArrayBuilder(String type)
Create new instance of array type.
|
BlockBuilder |
newBlock()
Create a new block.
|
NewInstanceBuilder |
newInstance(String type)
Build new instance creator of type using a no-argument constructor.
|
NewInstanceBuilder |
newInstance(org.eclipse.jdt.core.dom.Type type)
Build new instance creator of type using a no-argument constructor.
|
NewInstanceBuilder |
newInstanceFromString(String type,
String value)
Build new instance creator of a simple type using a constructor that takes a single string value.
|
NewInstanceBuilder |
newInstanceFromStrings(String type,
String value1,
String value2)
Build new instance creator of a simple type using a constructor that takes a pair of string values.
|
void |
setAbstract()
Set the abstract flag for this class.
|
void |
setSuperclass(String name)
Set the superclass for this class.
|
public ClassBuilder(org.eclipse.jdt.core.dom.AnonymousClassDeclaration clas,
ClassBuilder outer)
clas - outer - public void addField(org.eclipse.jdt.core.dom.FieldDeclaration field)
field - public void addMethod(org.eclipse.jdt.core.dom.MethodDeclaration method)
method - public void addType(org.eclipse.jdt.core.dom.TypeDeclaration type)
type - public void setSuperclass(String name)
name - public org.eclipse.jdt.core.dom.ASTNode clone(org.eclipse.jdt.core.dom.ASTNode node)
node - public org.eclipse.jdt.core.dom.Type createType(String type)
type - fully qualified type name, or primitive type namepublic org.eclipse.jdt.core.dom.Type createParameterizedType(String type, String param)
type - fully qualified type nameparam - fully qualified parameter type namepublic org.eclipse.jdt.core.dom.Type createParameterizedType(String type, org.eclipse.jdt.core.dom.Type param)
type - fully qualified type nameparam - type parameterpublic void addSourceComment(String text)
text - comment textpublic void setAbstract()
public String[] getInterfaces()
public org.eclipse.jdt.core.dom.FieldDeclaration[] getFields()
public org.eclipse.jdt.core.dom.MethodDeclaration[] getMethods()
public void addInterface(String type)
type - interface typepublic void addJavaDoc(String doc, org.eclipse.jdt.core.dom.BodyDeclaration decl)
doc - documentation text, or null if nonedecl - public void addEnumConstant(String value, String doc)
value - doc - documentation text, or null if nonepublic void addEnumConstant(String name, String doc, String value)
name - doc - documentation text, or null if nonevalue - public NewArrayBuilder newArrayBuilder(String type)
type - base type namepublic NewInstanceBuilder newInstance(org.eclipse.jdt.core.dom.Type type)
type - actual typepublic NewInstanceBuilder newInstance(String type)
type - base type namepublic NewInstanceBuilder newInstanceFromString(String type, String value)
type - simple type namevalue - string value to be passed to constructorpublic NewInstanceBuilder newInstanceFromStrings(String type, String value1, String value2)
type - simple type namevalue1 - first string value to be passed to constructorvalue2 - second string value to be passed to constructorpublic FieldBuilder addField(String name, org.eclipse.jdt.core.dom.Type type)
name - field nametype - field typepublic FieldBuilder addField(String name, String type)
name - field nametype - type namepublic FieldBuilder addIntField(String name, String value)
int field declaration with constant initialization.name - variable namevalue - initial valuepublic MethodBuilder addConstructor(String name)
name - simple class namepublic MethodBuilder addMethod(String name, org.eclipse.jdt.core.dom.Type type)
name - type - public MethodBuilder addMethod(String name, String type)
name - type - fully qualified type name or primitive type name, with optional array suffixespublic InvocationBuilder createMemberMethodCall(String mname)
mname - method namepublic InvocationBuilder createLocalStaticMethodCall(String mname)
mname - method namepublic InvocationBuilder createStaticMethodCall(String cname, String mname)
cname - fully qualified class namemname - method namepublic InvocationBuilder createStaticMethodCall(String fname)
fname - fully-qualified class and method namepublic InvocationBuilder createNormalMethodCall(String name, String mname)
name - local variable or field namemname - method namepublic InvocationBuilder createExpressionMethodCall(ExpressionBuilderBase expr, String mname)
expr - instance expressionmname - method namepublic InfixExpressionBuilder buildInfix(org.eclipse.jdt.core.dom.InfixExpression.Operator op)
op - operatorpublic InfixExpressionBuilder buildNameOp(String name, org.eclipse.jdt.core.dom.InfixExpression.Operator op)
name - local variable or field nameop - operatorpublic InfixExpressionBuilder buildStringConcatenation(String text)
text - literal textpublic PrefixExpressionBuilder buildPreincrement(String name)
name - local variable or field namepublic CastBuilder buildCast(org.eclipse.jdt.core.dom.Type type)
type - result typepublic CastBuilder buildCast(String type)
type - result typepublic ArrayAccessBuilder buildArrayIndexAccess(String aname, String iname)
aname - iname - public BlockBuilder newBlock()
public void finish()
public StringPair[] getSortedFields()
Copyright © 2005-2014 jibx.org. All Rights Reserved.