org.exolab.javasource
Class JAnnotationType
- JAnnotatedElement
public final class JAnnotationType
Describes the definition of a annotation type class.
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]";
}
addAnnotation , addField , addImport , addImport , addImport , addInterface , addInterface , addMember , getAnnotatedElementHelper , getAnnotation , getAnnotations , getField , getFields , getFilename , getHeader , getImports , getInterfaceCount , getInterfaces , getJDocComment , getModifiers , getName , getPackageFromClassName , getPackageName , hasAnnotations , hasImport , isAnnotationPresent , isValidClassName , print , print , print , printHeader , printImportDeclarations , printPackageDeclaration , printlnWithPrefix , removeAnnotation , removeImport , setHeader , setPackageName |
JAnnotationType
public JAnnotationType(String name)
Creates a JAnnotationType of the given name.
addElement
public void addElement(JAnnotationTypeElement jElement)
Adds the given JAnnotationTypeElement to this JAnnotationType.
jElement
- the element to add
addField
public void addField(JField jField)
Not implemented. Always throws a RuntimeException.
- addField in interface JStructure
addMember
public void addMember(JMember jMember)
Adds the given JMember to this JAnnotationType.
- addMember in interface JStructure
jMember
- the JMember to add
getElement
public JAnnotationTypeElement getElement(String name)
Returns the member with the given name, or null if no member was found
with the given name.
name
- the name of the member to return
- the member with the given name, or null if no member was found
with the given name.
getElements
public JAnnotationTypeElement[] getElements()
Returns an Array containing all our JAnnotationTypeElements.
- an Array containing all our JAnnotationTypeElements.
getField
public JField getField(String name)
Not implemented. Always throws a RuntimeException.
- getField in interface JStructure
main
public static void main(String[] args)
Test.
args
- command-line arguments
print
public void print(JSourceWriter jsw)
Prints the source code for this JAnnotationType to the given
JSourceWriter.
- print in interface JStructure
jsw
- the JSourceWriter to print to. Must not be null.
Intalio Inc. (C) 1999-2006. All rights reserved http://www.intalio.com