Interface AnnotationInfo


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).

  • Field Details

    • JAVA_LANG_ANNOTATION_CLASS_PREFIX

      static final String JAVA_LANG_ANNOTATION_CLASS_PREFIX

      Naming constant: The prefix for the java.lang.annotation package, (with a trailing ".").

      See Also:
    • JAVA_LANG_ANNOTATION_INHERITED

      static final String JAVA_LANG_ANNOTATION_INHERITED

      Text for the class name of the inherited meta-annotation.

      See Also:
    • ANNOTATION_CLASS_NAME

      static final String ANNOTATION_CLASS_NAME

      Naming constant: The qualified name of java.lang.annotation.Annotation.

      See Also:
  • Method Details

    • getHashText

      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.

      Returns:
      A print string for the receiver.
    • getInfoStore

      InfoStore getInfoStore()

      Answer the store which holds this info object.

      Returns:
      The store which holds this info object.
    • getAnnotationClassName

      String getAnnotationClassName()

      Answer the fully qualified name of the annotation class of this annotation occurrence.

      Returns:
      The fully qualified name of the annotation class of this annotation occurrence.
      See Also:
    • 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.

      Returns:
      The class info for the annotation type of this annotation instance.
      See Also:
    • isInherited

      boolean isInherited()

      Tell if this annotation has the inherited meta-annotation.

      Returns:
      True if this annotation has the inherited meta-annotation. Otherwise, false.
      See Also:
    • isValueDefaulted

      boolean isValueDefaulted(String name)
      Tell if the named child value was assigned using the default value from the annotation class.
      Parameters:
      name - The name of the child value which is to be tested.
      Returns:
      True if the child value was defaulted. Otherwise, false.
    • getValue

      AnnotationValue getValue(String name)
      Retrieves a named value associated with this AnnotationInfo object.
      Parameters:
      name - a String containing the named value to retrieve.
      Returns:
      an AnnotationValue object containing the annotation value with the given name, or null if the value does not exist.
    • getCachedAnnotationValue

      AnnotationValue getCachedAnnotationValue(String name)
      Retrieves a named value associated with this AnnotationInfo object. WITHOUT defaults processing. ALL CALLS SHOULD GO THROUGH getValue(String name) UNLESS a viable parent classloader is unavailable. In this case, resolution of classes of the form javax.annotation.etc... will not resolve, which may cause error messages or other exceptions. This returns ONLY the annotation values explicitly defined on the class, or null otherwise.
      Parameters:
      name - a String containing the named value to retrieve.
      Returns:
      an AnnotationValue object containing the annotation value with the given name, or null if the value does not exist.
    • getAnnotationValue

      AnnotationInfo getAnnotationValue(String name)

      Answer a member value of this annotation as an annotation.

      Parameters:
      name - The name of the member value to retrieve.
      Returns:
      A member value of this annotation as an annotation.
    • getArrayValue

      List<? extends AnnotationValue> getArrayValue(String name)

      Answer a member value of this annotation as an array.

      Parameters:
      name - The name of the member value to retrieve.
      Returns:
      A member value of this annotation as an array.
    • getBoolean

      Boolean getBoolean(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.

      Parameters:
      name - The name of the member value to retrieve.
      Returns:
      A member value of this annotation as a boolean object.
    • getBooleanValue

      boolean getBooleanValue(String name)

      Answer a member value of this annotation as a boolean value.

      A NullPointerException will occur is the named value is not available.

      Parameters:
      name - The name of the member value to retrieve.
      Returns:
      A member value of this annotation as a boolean value.
    • getByte

      Byte getByte(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.

      Parameters:
      name - The name of the member value to retrieve.
      Returns:
      A member value of this annotation as a byte object.
    • getByteValue

      byte getByteValue(String name)

      Answer a member value of this annotation as a byte value.

      A NullPointerException will occur is the named value is not available.

      Parameters:
      name - The name of the member value to retrieve.
      Returns:
      A member value of this annotation as a byte value.
    • getCharacter

      Character getCharacter(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.

      Parameters:
      name - The name of the member value to retrieve.
      Returns:
      A member value of this annotation as a character object.
    • getCharValue

      char getCharValue(String name)

      Answer a member value of this annotation as a char value.

      A NullPointerException will occur is the named value is not available.

      Parameters:
      name - The name of the member value to retrieve.
      Returns:
      A member value of this annotation as a char value.
    • getClassNameValue

      String getClassNameValue(String name)

      Answer a member value of this annotation as a class name (for a class reference value).

      Parameters:
      name - The name of the member value to retrieve.
      Returns:
      The member value as the class name of a class reference value.
    • getDouble

      Double getDouble(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.

      Parameters:
      name - The name of the member value to retrieve.
      Returns:
      A member value of this annotation a double object.
    • getDoubleValue

      double getDoubleValue(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.

      Parameters:
      name - The name of the member value to retrieve.
      Returns:
      A member value of this annotation a double value.
    • getEnumClassName

      String getEnumClassName(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.

      Parameters:
      name - The name of the member value to retrieve.
      Returns:
      The name of the class of a stored enumerated member value.
      See Also:
    • getEnumValue

      String getEnumValue(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.

      Parameters:
      name - The name of the member value to retrieve.
      Returns:
      The name of a stored enumerated member value.
      See Also: