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 and Description |
|---|
JAnnotationType(java.lang.String name)
Creates a JAnnotationType of the given name.
|
| Modifier and Type | Method and Description |
|---|---|
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 containing all our JAnnotationTypeElements.
|
JField |
getField(java.lang.String name)
Not implemented.
|
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.
|
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, setPackageNamechangePackage, getLocalName, getName, getWrapperName, isArray, isPrimitive, toStringpublic JAnnotationType(java.lang.String name)
name - Annotation namejava.lang.IllegalArgumentExceptionpublic void addMember(JMember jMember)
addMember in class JStructurejMember - the JMember to addpublic void addElement(JAnnotationTypeElement jElement)
jElement - the element to addpublic JAnnotationTypeElement getElement(java.lang.String name)
name - the name of the member to returnpublic JAnnotationTypeElement[] getElements()
public void addField(JField jField)
addField in class JStructurejField - not usedJStructure.addField(org.exolab.javasource.JField)public JField getField(java.lang.String name)
getField in class JStructurename - not usedJStructure.getField(java.lang.String)public JField[] getFields()
getFields in class JStructurepublic void print(JSourceWriter jsw)
print in class JStructurejsw - the JSourceWriter to print to. Must not be null.public static void main(java.lang.String[] args)
args - command-line argumentsIntalio Inc. (C) 1999-2006. All rights reserved http://www.intalio.com