|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.codehaus.modello.plugin.java.javasource.JType
org.codehaus.modello.plugin.java.javasource.JStructure
org.codehaus.modello.plugin.java.javasource.JInterface
public final class JInterface
A representation of the Java Source code for a Java Interface. This is a useful utility when creating in memory source code. The code in this package was modelled after the Java Reflection API as much as possible to reduce the learning curve.
| Field Summary |
|---|
| Fields inherited from class org.codehaus.modello.plugin.java.javasource.JType |
|---|
BOOLEAN, BYTE, CHAR, DOUBLE, FLOAT, INT, LONG, SHORT |
| Constructor Summary | |
|---|---|
JInterface(String name)
Creates a new JInterface with the given name. |
|
| Method Summary | |
|---|---|
void |
addField(JField jField)
Adds the given JField to this JStructure. |
void |
addMember(org.codehaus.modello.plugin.java.javasource.JMember jMember)
Adds the given JMember to this JStructure. |
void |
addMethod(JMethodSignature jMethodSig)
Adds the given JMethodSignature to this JClass |
void |
addSourceCode(String sourceCode)
|
JField |
getField(String name)
Returns the field with the given name, or null if no field was found with the given name. |
JField[] |
getFields()
Returns an array of all the JFields of this JStructure |
JMethodSignature |
getMethod(int index)
Returns the JMethodSignature at the given index. |
JMethodSignature |
getMethod(String name,
int startIndex)
Returns the JMethodSignature with the given name, and occuring at or after the given starting index. |
JMethodSignature[] |
getMethods()
Returns an array of all the JMethodSignatures of this JInterface. |
void |
print(JSourceWriter jsw)
Prints the source code for this JInterface to the given JSourceWriter |
void |
print(JSourceWriter jsw,
boolean classOnly)
Prints the source code for this JInterface to the given JSourceWriter |
| Methods inherited from class org.codehaus.modello.plugin.java.javasource.JStructure |
|---|
addImport, addInterface, addInterface, appendAnnotation, getAnnotations, getFilename, getHeader, getImports, getInterfaceCount, getInterfaces, getJDocComment, getModifiers, getName, getPackageFromClassName, getPackageName, hasImport, isAbstract, isValidClassName, print, print, printHeader, printImportDeclarations, printlnWithPrefix, printPackageDeclaration, removeImport, setAnnotations, setHeader, setPackageName |
| Methods inherited from class org.codehaus.modello.plugin.java.javasource.JType |
|---|
changePackage, createArray, getComponentType, getLocalName, getName, isArray, isPrimitive, toString |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public JInterface(String name)
throws IllegalArgumentException
name - the name of the JInterface.
IllegalArgumentException - when the given name
is not a valid Class name.| Method Detail |
|---|
public void addField(JField jField)
throws IllegalArgumentException
This method is implemented by subclasses and should only accept the proper fields for the subclass otherwise an IllegalArgumentException will be thrown. For example a JInterface will only accept static fields.
addField in class JStructurejField, - the JField to add
IllegalArgumentException - when the given
JField has a name of an existing JField
public void addMember(org.codehaus.modello.plugin.java.javasource.JMember jMember)
throws IllegalArgumentException
This method is implemented by subclasses and should only accept the proper types for the subclass otherwise an IllegalArgumentException will be thrown.
addMember in class JStructurejMember - the JMember to add to this JStructure.
IllegalArgumentException - when the given
JMember has the same name of an existing JField
or JMethod respectively.
public void addMethod(JMethodSignature jMethodSig)
throws IllegalArgumentException
jMethodSig - the JMethodSignature to add.
IllegalArgumentException - when the given
JMethodSignature conflicts with an existing
method signature.public JField getField(String name)
getField in class JStructurename - the name of the field to return.
public JField[] getFields()
getFields in class JStructurepublic JMethodSignature[] getMethods()
public JMethodSignature getMethod(String name,
int startIndex)
name - the name of the JMethodSignature to return.startIndex - the starting index to begin searching
from.
public JMethodSignature getMethod(int index)
index - the index of the JMethodSignature to return.
public void print(JSourceWriter jsw)
print in class JStructurejsw - the JSourceWriter to print to. [May not be null]
public void print(JSourceWriter jsw,
boolean classOnly)
jsw - the JSourceWriter to print to. [May not be null]public void addSourceCode(String sourceCode)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||