JAnnotatedElement
public final class JAnnotationType extends JStructure
JAnnotationType type = new JAnnotationType("RequestForEnhancement"); type.addElement(new JAnnotationTypeElement("id", JType.Int)); type.addElement(new JAnnotationTypeElement("synopsis", new JType("String"))); JAnnotationTypeElement engineer; engineer = new JAnnotationTypeElement("engineer", new JType("String")); engineer.setDefaultString("\"[unassigned]\""); type.addElement(engineer); JAnnotationTypeElement date; date = new JAnnotationTypeElement("date", new JType("String")); date.setDefaultString("\"[unimplemented]\""); type.addElement(date);outputs
public @interface RequestForEnhancement { int id(); String synopsis(); String engineer() default "[unassigned]"; String date() default "[unimplemented]"; }
Constructor | Description |
---|---|
JAnnotationType(java.lang.String name) |
Creates a JAnnotationType of the given name.
|
Modifier and Type | Method | Description |
---|---|---|
void |
addElement(JAnnotationTypeElement jElement) |
Adds the given JAnnotationTypeElement to this JAnnotationType.
|
void |
addField(JField jField) |
Not implemented.
|
void |
addImport(java.lang.String className) |
Adds the given import to this JStructure.
|
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 containing all our JAnnotationTypeElements.
|
JField |
getField(java.lang.String name) |
Not implemented.
|
JField[] |
getFields() |
Not implemented.
|
void |
print(JSourceWriter jsw) |
Deprecated.
Please use the Velocity-template based approach instead.
|
addAnnotation, addImport, addImport, addImportInternal, addInterface, 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
public JAnnotationType(java.lang.String name)
name
- Annotation name.public void addImport(java.lang.String className)
addImport
in class JStructure
className
- Name of the class to import.public void addMember(JMember jMember)
addMember
in class JStructure
jMember
- The JMember to add.public JAnnotationTypeElement[] getElements()
public JAnnotationTypeElement getElement(java.lang.String name)
name
- The name of the member to return.public void addElement(JAnnotationTypeElement jElement)
jElement
- The element to add.public JField[] getFields()
getFields
in class JStructure
public JField getField(java.lang.String name)
getField
in class JStructure
name
- The name of the field to return.public void addField(JField jField)
addField
in class JStructure
jField
- The JField to add.public void print(JSourceWriter jsw)
print
in class JStructure
jsw
- The JSourceWriter to print to.SourceGenerator.setJClassPrinterType(String)
Intalio Inc. (C) 1999-2008. All rights reserved http://www.intalio.com