|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.exolab.javasource.JType
org.exolab.javasource.JStructure
org.exolab.javasource.JAnnotationType
public class JAnnotationType
Class describes the definition of a annotation type class JAnnotationType annotationType = new JAnnotationType("RequestForEnhancement"); annotationType.addElement(new JAnnotationTypeElement("id", JType.Int)); annotationType.addElement(new JAnnotationTypeElement("synopsis", new JType("String"))); JAnnotationTypeElement enginer = new JAnnotationTypeElement("enginer", new JType("String")); enginer.setDefaultString("\"[unassigned]\""); annotationType.addElement(enginer); JAnnotationTypeElement date = new JAnnotationTypeElement("date", new JType("String")); date.setDefaultString("\"[unimplemented]\""); annotationType.addElement(date); Outputs public @interface RequestForEnhancement { int id(); String synopsis(); String enginer() default "[unassigned]"; String date() default "[unimplemented]"; }
Field Summary |
---|
Fields inherited from class org.exolab.javasource.JStructure |
---|
DEFAULT_HEADER, version |
Fields inherited from class org.exolab.javasource.JType |
---|
Boolean, Byte, Char, Double, Float, Int, Long, Short |
Constructor Summary | |
---|---|
JAnnotationType(java.lang.String name)
Creates a JAnnotationType of the given name |
Method Summary | |
---|---|
void |
addElement(JAnnotationTypeElement jElement)
Adds the given JAnnotationTypeElement to this JAnnotationType |
void |
addField(JField jField)
Not implemented. |
void |
addMember(JMember jMember)
Adds the given JMember to this JAnnotationType |
JAnnotationTypeElement |
getElement(java.lang.String name)
Returns the member with the given name, or null if no member was found with the given name |
JAnnotationTypeElement[] |
getElements()
Returns an array of all the JAnnotationTypeElements of this JClass |
JField |
getField(java.lang.String name)
Not implemnted. |
JField[] |
getFields()
Not implemented |
static void |
main(java.lang.String[] args)
Test |
void |
print(JSourceWriter jsw)
Prints the source code for this JAnnotationType to the given JSourceWriter |
Methods inherited from class org.exolab.javasource.JStructure |
---|
addAnnotation, addImport, addImport, addImport, addInterface, addInterface, getAnnotatedElementHelper, getAnnotation, getAnnotations, getFilename, getHeader, getImports, getInterfaceCount, getInterfaces, getJDocComment, getModifiers, getName, getPackageFromClassName, getPackageName, hasAnnotations, hasImport, isAnnotationPresent, isValidClassName, print, print, printHeader, printImportDeclarations, printlnWithPrefix, printPackageDeclaration, removeAnnotation, removeImport, setHeader, setPackageName |
Methods inherited from class org.exolab.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 JAnnotationType(java.lang.String name) throws java.lang.IllegalArgumentException
name
-
java.lang.IllegalArgumentException
Method Detail |
---|
public void addMember(JMember jMember) throws java.lang.IllegalArgumentException
addMember
in class JStructure
jMember,
- the JMember to add
java.lang.IllegalArgumentException
- when the given
JMember has the same name of an existing JAnnotationTypeElement
or if the JMember is of an unrecognized class.public void addElement(JAnnotationTypeElement jElement) throws java.lang.IllegalArgumentException
jElement,
- the element to add
java.lang.IllegalArgumentException
- when the given
JAnnotationTypeElement has the same name of an existing JAnnotationTypeElement.public JAnnotationTypeElement getElement(java.lang.String name)
name
- the name of the member to return
public JAnnotationTypeElement[] getElements()
public void addField(JField jField) throws java.lang.IllegalArgumentException
addField
in class JStructure
jField
-
java.lang.IllegalArgumentException
- when the given
JField has a name of an existing JFieldpublic JField getField(java.lang.String name)
getField
in class JStructure
name
-
public JField[] getFields()
getFields
in class JStructure
public void print(JSourceWriter jsw)
print
in class JStructure
jsw
- the JSourceWriter to print to. [May not be null]public static void main(java.lang.String[] args)
args
-
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |