org.exolab.javasource
Class JAnnotationType

java.lang.Object
  extended by org.exolab.javasource.JType
      extended by org.exolab.javasource.JStructure
          extended by org.exolab.javasource.JAnnotationType
All Implemented Interfaces:
JAnnotatedElement

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

Field Summary
 
Fields inherited from class org.exolab.javasource.JStructure
DEFAULT_HEADER, version
 
Fields inherited from class org.exolab.javasource.JType
Boolean, Byte, Char, Double, Float, Int, Long, Short
 
Constructor Summary
JAnnotationType(java.lang.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(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 of all the JAnnotationTypeElements of this JClass
 JField getField(java.lang.String name)
          Not implemnted.
 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
 
Methods inherited from class org.exolab.javasource.JStructure
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, setPackageName
 
Methods inherited from class org.exolab.javasource.JType
changePackage, createArray, getComponentType, getLocalName, getName, isArray, isPrimitive, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

JAnnotationType

public JAnnotationType(java.lang.String name)
                throws java.lang.IllegalArgumentException
Creates a JAnnotationType of the given name

Parameters:
name -
Throws:
java.lang.IllegalArgumentException
Method Detail

addMember

public void addMember(JMember jMember)
               throws java.lang.IllegalArgumentException
Adds the given JMember to this JAnnotationType

Specified by:
addMember in class JStructure
Parameters:
jMember, - the JMember to add
Throws:
java.lang.IllegalArgumentException - when the given JMember has the same name of an existing JAnnotationTypeElement or if the JMember is of an unrecognized class.

addElement

public void addElement(JAnnotationTypeElement jElement)
                throws java.lang.IllegalArgumentException
Adds the given JAnnotationTypeElement to this JAnnotationType

Parameters:
jElement, - the element to add
Throws:
java.lang.IllegalArgumentException - when the given JAnnotationTypeElement has the same name of an existing JAnnotationTypeElement.

getElement

public JAnnotationTypeElement getElement(java.lang.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

addField

public void addField(JField jField)
              throws java.lang.IllegalArgumentException
Not implemented.

Specified by:
addField in class JStructure
Parameters:
jField -
Throws:
java.lang.IllegalArgumentException - when the given JField has a name of an existing JField

getField

public JField getField(java.lang.String name)
Not implemnted.

Specified by:
getField in class JStructure
Parameters:
name -
Returns:
JField

getFields

public JField[] getFields()
Not implemented

Specified by:
getFields in class JStructure
Returns:
JField[]

print

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

Specified by:
print in class JStructure
Parameters:
jsw - the JSourceWriter to print to. [May not be null]

main

public static void main(java.lang.String[] args)
Test

Parameters:
args -


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