|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface JAnnotatedElement
Interface defines methods for manipuling annotations held against various program code elements, such as classes, fields, methods etc. This interface is simalar to the java.lang.reflect.AnnotatedElement. Accept that it also allows modifications of associated annotations. It is implemented by the classes within this package that represent applicable code elements. Adding class annotations JClass lollipop = new JClass("Lollipop"); JAnnotationType endorsersType = new JAnnotationType("Endorsers"); JAnnotation endorsers = new JAnnotation(endorsersType); endorsers.setValue(new String[] { "\"Children\"", "\"Unscrupulous dentists\""}); lollipop.addAnnotation(endorsers); Outputs
Method Summary | |
---|---|
void |
addAnnotation(JAnnotation annotation)
Adds a JAnnotation to this source element. |
JAnnotation |
getAnnotation(JAnnotationType annotationType)
Retrieves a JAnnotation for the given JAnnotationType, returns null if no annotation has been set. |
JAnnotation[] |
getAnnotations()
Returns a list of JAnnotation's already set on this source element |
boolean |
hasAnnotations()
Returns true if annotations have been added to this source element |
boolean |
isAnnotationPresent(JAnnotationType annotationType)
Returns true if a JAnnotation exists for the given JAnnotationType |
JAnnotation |
removeAnnotation(JAnnotationType annotationType)
Removes the JAnnotation from this source element for the given JAnnotationType, throws a IllegalArgumentException if no JAnnotation has been added. |
Method Detail |
---|
JAnnotation getAnnotation(JAnnotationType annotationType)
annotationType
-
JAnnotation[] getAnnotations()
boolean isAnnotationPresent(JAnnotationType annotationType)
annotationType
-
void addAnnotation(JAnnotation annotation) throws java.lang.IllegalArgumentException
annotation
-
java.lang.IllegalArgumentException
JAnnotation removeAnnotation(JAnnotationType annotationType) throws java.lang.IllegalArgumentException
annotationType
-
java.lang.IllegalArgumentException
boolean hasAnnotations()
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |