org.exolab.javasource
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 Summary | |
|---|---|
| JAnnotationType(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(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(String name)
Not implemented. |
| JField[] | getFields()
Not implemented. |
| static void | main(String[] args)
Test. |
| void | print(JSourceWriter jsw)
Prints the source code for this JAnnotationType to the given
JSourceWriter.
|
Parameters: name Annotation name
Throws: IllegalArgumentException
Parameters: jElement the element to add
Parameters: jField not used
See Also: JStructure
Parameters: jMember the JMember to add
Parameters: name the name of the member to return
Returns: the member with the given name, or null if no member was found with the given name.
Returns: an Array containing all our JAnnotationTypeElements.
Parameters: name not used
Returns: nothing is ever returned
See Also: JStructure
Returns: nothing is ever returned
Parameters: args command-line arguments
Parameters: jsw the JSourceWriter to print to. Must not be null.