public interface AnnotationInfo
Type for annotation instances.
Targeting notes:
Annotations may be attached to packages, to classes, to fields, to methods, and to method parameters.
Particular rules are used to associate annotations to entities in addition to the declaring entity. There are particular rules for inherited methods and fields, particular rules for class and method annotations marked with the inherited meta-annotations, and particular rules for class annotations which have application to methods and fields.
A method or a field annotation not only applies to the method or field which declares the annotation, in the class which declares the method or field, but also apply to the method or field in any subclass which inherites the method or field, but which does not provide a new implementation.
A class annotation which has the inherited meta-annotation not only applies to the class which declared that annotation, but also applies to subclasses of that declaring class. A method annotation which has the inherited meta-annotation not only applies to the method in the class which declares the method and the annotation, but applies as well to the method in any subclasses of the declaring class.
A class annotation which is specified to target fields (or methods), and which is declared on a class has applications to declared fields (or declared methods) of the declaring class. The general rule is to apply the class annotation to declared fields (or declared methods). There are special cases where the general rule is modified to limit application to specific fields (or methods).
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
ANNOTATION_CLASS_NAME
Naming constant: The qualified name of
java.lang.annotation.Annotation . |
static java.lang.String |
JAVA_LANG_ANNOTATION_CLASS_PREFIX
Naming constant: The prefix for the
java.lang.annotation package,
(with a trailing "."). |
static java.lang.String |
JAVA_LANG_ANNOTATION_INHERITED
Text for the class name of the
inherited meta-annotation. |
Modifier and Type | Method and Description |
---|---|
ClassInfo |
getAnnotationClassInfo()
Answer the class of the annotation type of this annotation instance.
|
java.lang.String |
getAnnotationClassName()
Answer the fully qualified name of the annotation class of this
annotation occurrence.
|
AnnotationInfo |
getAnnotationValue(java.lang.String name)
Answer a member value of this annotation as an annotation.
|
java.util.List<? extends AnnotationValue> |
getArrayValue(java.lang.String name)
Answer a member value of this annotation as an array.
|
java.lang.Boolean |
getBoolean(java.lang.String name)
Answer a member value of this annotation as a boolean object.
|
boolean |
getBooleanValue(java.lang.String name)
Answer a member value of this annotation as a boolean value.
|
java.lang.Byte |
getByte(java.lang.String name)
Answer a member value of this annotation as a byte object.
|
byte |
getByteValue(java.lang.String name)
Answer a member value of this annotation as a byte value.
|
AnnotationValue |
getCachedAnnotationValue(java.lang.String name)
Retrieves a named value associated with this AnnotationInfo object.
|
java.lang.Character |
getCharacter(java.lang.String name)
Answer a member value of this annotation as a character object.
|
char |
getCharValue(java.lang.String name)
Answer a member value of this annotation as a char value.
|
java.lang.String |
getClassNameValue(java.lang.String name)
Answer a member value of this annotation as a class name (for a class reference value).
|
java.lang.Double |
getDouble(java.lang.String name)
Answer a member value of this annotation as a double object.
|
double |
getDoubleValue(java.lang.String name)
Answer a member value of this annotation as a simple double (double
precision floating point) value.
|
java.lang.String |
getEnumClassName(java.lang.String name)
Answer the name of the class of a stored enumerated member value.
|
java.lang.String |
getEnumValue(java.lang.String name)
Answer the name of a stored enumerated member value.
|
java.lang.String |
getHashText()
Answer a print string for the receiver, for use in debugging.
|
InfoStore |
getInfoStore()
Answer the store which holds this info object.
|
AnnotationValue |
getValue(java.lang.String name)
Retrieves a named value associated with this AnnotationInfo object.
|
boolean |
isInherited()
Tell if this annotation has the
inherited meta-annotation. |
boolean |
isValueDefaulted(java.lang.String name)
Tell if the named child value was assigned using the
default value from the annotation class.
|
static final java.lang.String JAVA_LANG_ANNOTATION_CLASS_PREFIX
Naming constant: The prefix for the java.lang.annotation
package,
(with a trailing ".").
static final java.lang.String JAVA_LANG_ANNOTATION_INHERITED
Text for the class name of the inherited
meta-annotation.
static final java.lang.String ANNOTATION_CLASS_NAME
Naming constant: The qualified name of java.lang.annotation.Annotation
.
java.lang.String getHashText()
Answer a print string for the receiver, for use in debugging. The value is guaranteed to be unique during the lifetime of the receiver, and, for frequently created types, will be created on demand.
InfoStore getInfoStore()
Answer the store which holds this info object.
java.lang.String getAnnotationClassName()
Answer the fully qualified name of the annotation class of this annotation occurrence.
getAnnotationClassInfo()
ClassInfo getAnnotationClassInfo()
Answer the class of the annotation type of this annotation instance.
If attached to a class, the result is very much not that class. If attached to a method or field, this is not the class of the method or field.
getAnnotationClassName()
boolean isInherited()
Tell if this annotation has the inherited
meta-annotation.
inherited
meta-annotation.
Otherwise, false.JAVA_LANG_ANNOTATION_INHERITED
boolean isValueDefaulted(java.lang.String name)
name
- The name of the child value which is to be tested.AnnotationValue getValue(java.lang.String name)
name
- a String containing the named value to retrieve.AnnotationValue getCachedAnnotationValue(java.lang.String name)
name
- a String containing the named value to retrieve.AnnotationInfo getAnnotationValue(java.lang.String name)
Answer a member value of this annotation as an annotation.
name
- The name of the member value to retrieve.java.util.List<? extends AnnotationValue> getArrayValue(java.lang.String name)
Answer a member value of this annotation as an array.
name
- The name of the member value to retrieve.java.lang.Boolean getBoolean(java.lang.String name)
Answer a member value of this annotation as a boolean object.
Answer null if the named member is not available. Absent full defaulting support, valid members will return null if no user defined value was provided.
name
- The name of the member value to retrieve.boolean getBooleanValue(java.lang.String name)
Answer a member value of this annotation as a boolean value.
A NullPointerException
will occur is the named value
is not available.
name
- The name of the member value to retrieve.java.lang.Byte getByte(java.lang.String name)
Answer a member value of this annotation as a byte object.
Answer null if the named member is not available. Absent full defaulting support, valid members will return null if no user defined value was provided.
name
- The name of the member value to retrieve.byte getByteValue(java.lang.String name)
Answer a member value of this annotation as a byte value.
A NullPointerException
will occur is the named value
is not available.
name
- The name of the member value to retrieve.java.lang.Character getCharacter(java.lang.String name)
Answer a member value of this annotation as a character object.
Answer null if the named member is not available. Absent full defaulting support, valid members will return null if no user defined value was provided.
name
- The name of the member value to retrieve.char getCharValue(java.lang.String name)
Answer a member value of this annotation as a char value.
A NullPointerException
will occur is the named value
is not available.
name
- The name of the member value to retrieve.java.lang.String getClassNameValue(java.lang.String name)
Answer a member value of this annotation as a class name (for a class reference value).
name
- The name of the member value to retrieve.java.lang.Double getDouble(java.lang.String name)
Answer a member value of this annotation as a double object.
Answer null if the named member is not available. Absent full defaulting support, valid members will return null if no user defined value was provided.
name
- The name of the member value to retrieve.double getDoubleValue(java.lang.String name)
Answer a member value of this annotation as a simple double (double precision floating point) value.
A NullPointerException
will occur is the named value
is not available.
name
- The name of the member value to retrieve.java.lang.String getEnumClassName(java.lang.String name)
Answer the name of the class of a stored enumerated member value.
Answer null if the named member is not available or has a null value. Absent full defaulting support, valid members will return null if no user defined value was provided.
name
- The name of the member value to retrieve.getEnumValue(String)
java.lang.String getEnumValue(java.lang.String name)
Answer the name of a stored enumerated member value.
Answer null if the named member is not available or has a null value. Absent full defaulting support, valid members will return null if no user defined value was provided.
name
- The name of the member value to retrieve.getEnumClassName(String)