JAnnotatedElement
JClass
public abstract class AbstractJClass extends JStructure
Modifier | Constructor | Description |
---|---|---|
protected |
AbstractJClass(java.lang.String name) |
Creates a new AbstractJClass with the given name.
|
Modifier and Type | Method | Description |
---|---|---|
void |
addConstant(JConstant jConstant) |
|
void |
addConstructor(JConstructor constructor) |
Adds the given Constructor to this classes list of constructors.
|
void |
addField(JField jField) |
Adds the given JField to this JStructure.
|
void |
addMethod(JMethod jMethod) |
Adds the given JMethod to this JClass.
|
void |
addMethod(JMethod jMethod,
boolean importReturnType) |
Adds the given JMethod to this JClass.
|
void |
addMethods(JMethod[] jMethods) |
Adds the given array of JMethods to this JClass.
|
void |
addSourceCode(java.lang.String sourceCode) |
Adds a complete source code fragment (method) to this class.
|
JConstructor |
createConstructor() |
Creates a new JConstructor and adds it to this JClass.
|
JConstructor |
createConstructor(JParameter[] params) |
Creates a new JConstructor and adds it to this JClass.
|
JClass |
createInnerClass(java.lang.String localname) |
Creates and returns an inner-class for this JClass.
|
JConstant |
getConstant(java.lang.String name) |
|
int |
getConstantCount() |
Returns the amount of constants.
|
JConstant[] |
getConstants() |
|
JConstructor |
getConstructor(int index) |
Returns the constructor at the specified index.
|
JConstructor[] |
getConstructors() |
Returns the an array of the JConstructors contained within this JClass.
|
int |
getContructorsCount() |
|
JField |
getField(java.lang.String name) |
Returns the field with the given name, or null if no field was found with
that name.
|
int |
getFieldCount() |
Returns the amount of fields.
|
JField[] |
getFields() |
Returns an array of all the JFields of this JStructure.
|
int |
getInnerClassCount() |
|
JClass[] |
getInnerClasses() |
Returns an array of JClass (the inner classes) contained within this
JClass.
|
JMethod |
getMethod(int index) |
Returns the JMethod located at the specified index.
|
JMethod |
getMethod(java.lang.String name,
int startIndex) |
Returns the first occurance of the method with the given name, starting
from the specified index.
|
int |
getMethodCount() |
|
JMethod[] |
getMethods() |
Returns an array of all the JMethods of this JClass.
|
java.lang.String[] |
getSourceCodeEntries() |
Returns a collection of (complete) source code fragments.
|
int |
getSourceCodeEntryCount() |
|
JSourceCode |
getStaticInitializationCode() |
Returns the JSourceCode for the static initializer of this JClass.
|
void |
print(JSourceWriter jsw) |
Deprecated.
Please use the Velocity-template based approach instead.
|
abstract void |
print(JSourceWriter jsw,
boolean classOnly) |
Deprecated.
Please use the Velocity-template based approach instead.
|
protected void |
printClassHeaders(JSourceWriter jsw) |
Writes to the JSourceWriter the headers for this class file.
|
protected void |
printConstantDefinitions(JSourceWriter jsw) |
Writes to the
JSourceWriter the constant definitions of this class. |
protected void |
printConstructors(JSourceWriter jsw) |
Writes to the JSourceWriter all constructors for this class.
|
protected void |
printInnerClasses(JSourceWriter jsw) |
Writes to the JSourceWriter all inner classes belonging to this class.
|
protected void |
printMemberVariables(JSourceWriter jsw) |
Writes to the JSourceWriter the member variables of this class.
|
protected void |
printMethods(JSourceWriter jsw) |
Writes to the JSourceWriter all methods belonging to this class.
|
protected void |
printSourceCodeFragments(JSourceWriter sourceWriter) |
|
protected void |
printStaticInitializers(JSourceWriter jsw) |
Writes to the JSourceWriter any static initialization used by this class.
|
JConstant |
removeConstant(java.lang.String name) |
Removes the constant with the given name from this
JClass . |
boolean |
removeConstant(JConstant jConstant) |
|
boolean |
removeConstructor(JConstructor constructor) |
Removes the given constructor from this JClass.
|
JField |
removeField(java.lang.String name) |
Removes the field with the given name from this JClass.
|
boolean |
removeField(JField jField) |
Removes the given JField from this JClass.
|
boolean |
removeInnerClass(JClass jClass) |
Removes the given inner-class (JClass) from this JClass.
|
boolean |
removeMethod(JMethod method) |
Removes the given method from this JClass.
|
addAnnotation, addImport, addImport, addImport, addImportInternal, addInterface, addMember, getAnnotatedElementHelper, getAnnotation, getAnnotations, getFilename, getHeader, getImportCount, getImports, getInterfaceCount, getInterfaces, getJDocComment, getModifiers, getPackageName, hasAnnotations, hasImport, isAnnotationPresent, print, printHeader, printImportDeclarations, printPackageDeclaration, removeAnnotation, removeImport, removeInterface, setHeader, toString
getLocalName, getName, isArray, isPrimitive, setName
protected AbstractJClass(java.lang.String name)
name
- The name of the AbstractJClass to create.public java.lang.String[] getSourceCodeEntries()
public final JSourceCode getStaticInitializationCode()
public final JField getField(java.lang.String name)
getField
in class JStructure
name
- The name of the field to return.public final JConstant getConstant(java.lang.String name)
public final JField[] getFields()
getFields
in class JStructure
public final JConstant[] getConstants()
public final int getFieldCount()
public final int getConstantCount()
public final void addField(JField jField)
addField
in class JStructure
jField
- The JField to add.public final void addConstant(JConstant jConstant)
public final JField removeField(java.lang.String name)
name
- The name of the field to remove.public final JConstant removeConstant(java.lang.String name)
JClass
.name
- The name of the constant to remove.public final boolean removeField(JField jField)
jField
- The JField to remove.public final boolean removeConstant(JConstant jConstant)
jConstant
- The JConstant
to remove.public final JConstructor createConstructor()
public final JConstructor createConstructor(JParameter[] params)
params
- A list of parameters for this constructor.public final JConstructor getConstructor(int index)
index
- The index of the constructor to return.public final JConstructor[] getConstructors()
public final int getContructorsCount()
public void addConstructor(JConstructor constructor)
constructor
- The constructor to add.public final boolean removeConstructor(JConstructor constructor)
constructor
- The JConstructor to remove.public final JMethod[] getMethods()
public final JMethod getMethod(java.lang.String name, int startIndex)
name
- The name of the method to look for.startIndex
- The starting index to begin the search.public final JMethod getMethod(int index)
index
- The index of the JMethod to return.public final int getMethodCount()
public final void addMethod(JMethod jMethod, boolean importReturnType)
jMethod
- The JMethod to add.importReturnType
- true if we add the importReturnType to the class
import lists. It could be useful to set it to false when all
types are fully qualified.public final void addMethod(JMethod jMethod)
jMethod
- The JMethod to add.public final void addMethods(JMethod[] jMethods)
jMethods
- The JMethod[] to add.public final boolean removeMethod(JMethod method)
method
- The JMethod to remove.public final JClass createInnerClass(java.lang.String localname)
localname
- The name of the class (no package name).public final JClass[] getInnerClasses()
public final int getInnerClassCount()
public final boolean removeInnerClass(JClass jClass)
jClass
- The JClass (inner-class) to remove.public final void print(JSourceWriter jsw)
print
in class JStructure
jsw
- The JSourceWriter to print to.SourceGenerator.setJClassPrinterType(String)
public abstract void print(JSourceWriter jsw, boolean classOnly)
classOnly
- If true, the file header, package declaration, and
imports are not printed.jsw
- The JSourceWriter to print to. Must not be null.SourceGenerator.setJClassPrinterType(String)
protected final void printClassHeaders(JSourceWriter jsw)
jsw
- The JSourceWriter to be used.protected final void printConstantDefinitions(JSourceWriter jsw)
JSourceWriter
the constant definitions of this class.jsw
- The JSourceWriter to be used.protected final void printMemberVariables(JSourceWriter jsw)
jsw
- The JSourceWriter to be used.protected final void printStaticInitializers(JSourceWriter jsw)
jsw
- The JSourceWriter to be used.protected final void printConstructors(JSourceWriter jsw)
jsw
- The JSourceWriter to be used.protected final void printMethods(JSourceWriter jsw)
jsw
- The JSourceWriter to be used.protected final void printSourceCodeFragments(JSourceWriter sourceWriter)
protected final void printInnerClasses(JSourceWriter jsw)
jsw
- The JSourceWriter to be used.public void addSourceCode(java.lang.String sourceCode)
sourceCode
- The complete source code fragment to be added.public final int getSourceCodeEntryCount()
Intalio Inc. (C) 1999-2008. All rights reserved http://www.intalio.com