org.exolab.javasource

Class JAnnotationType

public class JAnnotationType extends JStructure

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]"; }

Author: Andrew Fawcett

Constructor Summary
JAnnotationType(String name)
Creates a JAnnotationType of the given name
Method Summary
voidaddElement(JAnnotationTypeElement jElement)
Adds the given JAnnotationTypeElement to this JAnnotationType
voidaddField(JField jField)
Not implemented.
voidaddMember(JMember jMember)
Adds the given JMember to this JAnnotationType
JAnnotationTypeElementgetElement(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
JFieldgetField(String name)
Not implemnted.
JField[]getFields()
Not implemented
static voidmain(String[] args)
Test
voidprint(JSourceWriter jsw)
Prints the source code for this JAnnotationType to the given JSourceWriter

Constructor Detail

JAnnotationType

public JAnnotationType(String name)
Creates a JAnnotationType of the given name

Parameters: name

Throws: IllegalArgumentException

Method Detail

addElement

public void addElement(JAnnotationTypeElement jElement)
Adds the given JAnnotationTypeElement to this JAnnotationType

Parameters: jElement, the element to add

Throws: IllegalArgumentException when the given JAnnotationTypeElement has the same name of an existing JAnnotationTypeElement.

addField

public void addField(JField jField)
Not implemented.

Parameters: jField

addMember

public void addMember(JMember jMember)
Adds the given JMember to this JAnnotationType

Parameters: jMember, the JMember to add

Throws: IllegalArgumentException when the given JMember has the same name of an existing JAnnotationTypeElement or if the JMember is of an unrecognized class.

getElement

public JAnnotationTypeElement getElement(String name)
Returns the member with the given name, or null if no member was found with the given name

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

getElements

public JAnnotationTypeElement[] getElements()
Returns an array of all the JAnnotationTypeElements of this JClass

Returns: an array of all the JAnnotationTypeElements of this JClass

getField

public JField getField(String name)
Not implemnted.

Parameters: name

Returns: JField

getFields

public JField[] getFields()
Not implemented

Returns: JField[]

main

public static void main(String[] args)
Test

Parameters: args

print

public void print(JSourceWriter jsw)
Prints the source code for this JAnnotationType to the given JSourceWriter

Parameters: jsw the JSourceWriter to print to. [May not be null]

Intalio Inc. (C) 1999-2004. All rights reserved http://www.intalio.com