com.ibm.wsspi.anno.info

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 Summary

      Fields 
      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.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      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.
    • Field Detail

      • JAVA_LANG_ANNOTATION_CLASS_PREFIX

        static final java.lang.String JAVA_LANG_ANNOTATION_CLASS_PREFIX

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

        See Also:
        Constant Field Values
      • JAVA_LANG_ANNOTATION_INHERITED

        static final java.lang.String JAVA_LANG_ANNOTATION_INHERITED

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

        See Also:
        Constant Field Values
      • ANNOTATION_CLASS_NAME

        static final java.lang.String ANNOTATION_CLASS_NAME

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

        See Also:
        Constant Field Values
    • Method Detail

      • getHashText

        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.

        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

        java.lang.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()
      • 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:
        getAnnotationClassName()
      • 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:
        JAVA_LANG_ANNOTATION_INHERITED
      • isValueDefaulted

        boolean isValueDefaulted(java.lang.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(java.lang.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(java.lang.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(java.lang.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

        java.util.List<? extends AnnotationValue> getArrayValue(java.lang.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

        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.

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

        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.

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

        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.

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

        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.

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

        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.

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

        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.

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

        java.lang.String getClassNameValue(java.lang.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

        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.

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

        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.

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

        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.

        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

        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.

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