org.exolab.javasource

Class JAnnotationType

Implemented Interfaces:
JAnnotatedElement

public final class JAnnotationType
extends JStructure

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]";
   }
 
Version:
$Revision: 6673 $ $Date: 2006-04-25 16:09:10 -0600 (Tue, 25 Apr 2006) $
Author:
Andrew Fawcett

Field Summary

Fields inherited from class org.exolab.javasource.JType

BOOLEAN, BYTE, CHAR, DOUBLE, FLOAT, INT, LONG, SHORT

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
addImport(String className)
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.
void
print(JSourceWriter jsw)

Methods inherited from class org.exolab.javasource.JStructure

addAnnotation, addField, addImport, addImport, addImport, addImportInternal, addInterface, addMember, getAnnotatedElementHelper, getAnnotation, getAnnotations, getField, getFields, getFilename, getHeader, getImportCount, getImports, getInterfaceCount, getInterfaces, getJDocComment, getModifiers, getPackageName, hasAnnotations, hasImport, isAnnotationPresent, print, print, printHeader, printImportDeclarations, printPackageDeclaration, removeAnnotation, removeImport, setHeader, toString

Methods inherited from class org.exolab.javasource.JType

getLocalName, getName, isArray, isPrimitive, setName

Constructor Details

JAnnotationType

public JAnnotationType(String name)
Creates a JAnnotationType of the given name.
Parameters:
name - Annotation name.

Method Details

addElement

public void addElement(JAnnotationTypeElement jElement)
Adds the given JAnnotationTypeElement to this JAnnotationType.
Parameters:
jElement - The element to add.

addField

public void addField(JField jField)
Not implemented. Always throws a RuntimeException.
Overrides:
addField in interface JStructure

addImport

public void addImport(String className)
Overrides:
addImport in interface JStructure

addMember

public void addMember(JMember jMember)
Adds the given JMember to this JAnnotationType.
Overrides:
addMember in interface JStructure
Parameters:
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.
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 containing all our JAnnotationTypeElements.
Returns:
An Array containing all our JAnnotationTypeElements.

getField

public JField getField(String name)
Not implemented. Always throws a RuntimeException.
Overrides:
getField in interface JStructure

getFields

public JField[] getFields()
Not implemented. Always throws a RuntimeException.
Overrides:
getFields in interface JStructure

print

public void print(JSourceWriter jsw)
Overrides:
print in interface JStructure

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