|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.exolab.javasource.JAnnotation
public class JAnnotation
JAnnotation represents a single annotation against a code element. The methods described on the JAnnotatedElement interface are used to associate JAnnotation's with various other objects in this package describing Java code elements. The print method outputs annotations in various forms (as described in the Java Language Specificaiton Third Edition) based on the methods called. For "Marker Annotation", construct with the approprite JAnnotationType. JAnnotationType preliminaryType = new JAnnotationType("Preliminary"); JAnnotation preliminary = new JAnnotation(preliminaryType); Outputs
Field Summary | |
---|---|
static java.lang.String |
value
Name of a single element |
Constructor Summary | |
---|---|
JAnnotation(JAnnotationType annotationType)
Constructs a JAnnotation for the given annotation type |
Method Summary | |
---|---|
JAnnotationType |
getAnnotationType()
Returns the JAnnotationType associated with this JAnnotation |
java.lang.String[] |
getElementNames()
Returns the names of the elements set by this annotation |
java.lang.String |
getElementValue(java.lang.String elementName)
Returns the given annotation element value |
JAnnotation |
getElementValueAnnotation(java.lang.String elementName)
Returns the given annotation element value as a JAnnotation |
JAnnotation[] |
getElementValueAnnotationList(java.lang.String elementName)
Returns the given annotation element value as a JAnnotation list |
java.lang.String[] |
getElementValueList(java.lang.String elementName)
Returns the given annotation element value as a list |
java.lang.Object |
getElementValueObject(java.lang.String elementName)
Returns the given annotation element value as Object, typically used if the value type is not known. |
java.lang.String |
getValue()
Returns the "value" annotation element value |
JAnnotation |
getValueAnnotation()
Returns the "value" annotation element value as an JAnnotation |
static void |
main(java.lang.String[] args)
Test |
void |
print(JSourceWriter jsw)
Prints the source code for this JAnnotation to the given JSourceWriter |
void |
setElementValue(java.lang.String elementName,
JAnnotation annotationValue)
Sets the given annotation element value as an annotation |
void |
setElementValue(java.lang.String elementName,
JAnnotation[] annotationValues)
Sets the given annotation element values as a list of annotation values |
void |
setElementValue(java.lang.String elementName,
java.lang.String stringValue)
Sets the given annotation element value |
void |
setElementValue(java.lang.String elementName,
java.lang.String[] stringValues)
Sets the given annotation element value as a list |
void |
setValue(JAnnotation annotationValue)
Sets the "value" annotation element value as an annotation |
void |
setValue(JAnnotation[] annotationValues)
Sets the "value" annotation element value as a list of annotation values |
void |
setValue(java.lang.String stringValue)
Sets the "value" annotation element value |
void |
setValue(java.lang.String[] stringValue)
Sets the "value" annotation element value as a list |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String value
Constructor Detail |
---|
public JAnnotation(JAnnotationType annotationType)
annotationType
- Method Detail |
---|
public JAnnotationType getAnnotationType()
public void setValue(java.lang.String stringValue)
stringValue
- public void setValue(java.lang.String[] stringValue)
stringValue
- public void setValue(JAnnotation annotationValue)
annotationValue
- public void setValue(JAnnotation[] annotationValues)
annotationValues
- public void setElementValue(java.lang.String elementName, java.lang.String stringValue)
elementName
- stringValue
- public void setElementValue(java.lang.String elementName, java.lang.String[] stringValues)
elementName
- stringValues
- public void setElementValue(java.lang.String elementName, JAnnotation annotationValue)
elementName
- annotationValue
- public void setElementValue(java.lang.String elementName, JAnnotation[] annotationValues)
elementName
- annotationValues
- public java.lang.String getValue()
java.lang.IllegalStateException
- when the element value is not a Stringpublic JAnnotation getValueAnnotation() throws java.lang.IllegalStateException
java.lang.IllegalStateException
- when the element value is not a JAnnotationpublic java.lang.String getElementValue(java.lang.String elementName) throws java.lang.IllegalStateException
elementName
-
java.lang.IllegalArgumentException
- when the element value is not a String
java.lang.IllegalStateException
public java.lang.String[] getElementValueList(java.lang.String elementName) throws java.lang.IllegalStateException
elementName
-
java.lang.IllegalArgumentException
- when the element value is not a String[]
java.lang.IllegalStateException
public java.lang.Object getElementValueObject(java.lang.String elementName)
elementName
-
public JAnnotation getElementValueAnnotation(java.lang.String elementName) throws java.lang.IllegalStateException
elementName
-
java.lang.IllegalArgumentException
- when the element value is not a JAnnotation
java.lang.IllegalStateException
public JAnnotation[] getElementValueAnnotationList(java.lang.String elementName) throws java.lang.IllegalStateException
elementName
-
java.lang.IllegalArgumentException
- when the element value is not a JAnnotation[]
java.lang.IllegalStateException
public java.lang.String[] getElementNames()
public void print(JSourceWriter jsw)
jsw
- the JSourceWriter to print to. [May not be null]public static void main(java.lang.String[] args)
args
-
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |