Class AnnotationInfo


  • public final class AnnotationInfo
    extends Object
    Represents the aggregated annotations on a type, its fields and methods including annotations "inherited" from super-classes and implemented interfaces. Should a field or method from a super-class be overridden the Annotation closest to the represented type (the overriding one) is kept.
    • Method Detail

      • getType

        public org.glassfish.hk2.classmodel.reflect.ExtensibleType<? extends org.glassfish.hk2.classmodel.reflect.ExtensibleType> getType()
      • getAnnotation

        public org.glassfish.hk2.classmodel.reflect.AnnotationModel getAnnotation​(Class<? extends Annotation> annotationType)
        Version of Class.getAnnotation(Class) also considering annotations "inherited" from super-types for this getType().
        Parameters:
        annotationType - annotation type to check
        Returns:
        the annotation of the given type if present or null otherwise
      • getAnnotation

        public org.glassfish.hk2.classmodel.reflect.AnnotationModel getAnnotation​(Class<? extends Annotation> annotationType,
                                                                                  org.glassfish.hk2.classmodel.reflect.FieldModel field)
        Version of Field.getAnnotation(Class) also considering annotations "inherited" from overridden fields of super-types.
        Parameters:
        annotationType - annotation type to check
        method - must be a Field defined or inherited by this getType()
        Returns:
        the annotation of the given type if present or null otherwise
      • getAnnotation

        public org.glassfish.hk2.classmodel.reflect.AnnotationModel getAnnotation​(Class<? extends Annotation> annotationType,
                                                                                  org.glassfish.hk2.classmodel.reflect.MethodModel method)
        Version of Method.getAnnotation(Class) also considering annotations "inherited" from overridden methods of super-types.
        Parameters:
        annotationType - annotation type to check
        method - must be a Method defined or inherited by this getType()
        Returns:
        the annotation of the given type if present or null otherwise
      • getAnnotation

        public org.glassfish.hk2.classmodel.reflect.AnnotationModel getAnnotation​(Class<? extends Annotation> annotationType,
                                                                                  org.glassfish.hk2.classmodel.reflect.Parameter parameter)
        Version of Parameter#getAnnotation(Class) also considering annotations "inherited" from overridden methods of super-types.
        Parameters:
        annotationType - annotation type to check
        parameter - must be this a Parameter of a Method defined or inherited by this getType()
        Returns:
        the annotation of the given type if present or null otherwise
      • getAnnotationValue

        public String getAnnotationValue​(Class<? extends Annotation> annotationType,
                                         org.glassfish.hk2.classmodel.reflect.AnnotatedElement parameter)
      • getAnnotation

        public org.glassfish.hk2.classmodel.reflect.AnnotationModel getAnnotation​(Class<? extends Annotation> annotationType,
                                                                                  org.glassfish.hk2.classmodel.reflect.AnnotatedElement element)
        Version of AnnotatedElement#getAnnotation(Class) also considering annotations "inherited" from super-types.
        Parameters:
        annotationType - annotation type to check
        element - must be this getType()'s Class or a Field or Method defined or inherited by it or a Parameter of such a method.
        Returns:
        the annotation of the given type if present or null otherwise
      • isAnnotationPresent

        public boolean isAnnotationPresent​(Class<? extends Annotation> annotationType)
        Version of Class.isAnnotationPresent(Class) also considering annotations "inherited" from super-types.
        Parameters:
        annotationType - annotation type to check
        Returns:
        true in case it is present at this class or any of its super-types
      • isAnnotationPresent

        public boolean isAnnotationPresent​(Class<? extends Annotation> annotationType,
                                           org.glassfish.hk2.classmodel.reflect.FieldModel field)
        Version of AccessibleObject.isAnnotationPresent(Class) also considering annotations "inherited" from super-types.
        Parameters:
        annotationType - annotation type to check
        Returns:
        true in case it is present at the given field. The field must be defined in this getType() or any of its super-types.
      • isAnnotationPresent

        public boolean isAnnotationPresent​(Class<? extends Annotation> annotationType,
                                           org.glassfish.hk2.classmodel.reflect.MethodModel method)
        Version of AccessibleObject.isAnnotationPresent(Class) also considering annotations "inherited" from super-types.
        Parameters:
        annotationType - annotation type to check
        method - the method checked for annotation. The method must be defined or inherited by this getType() or any of its super-types.
        Returns:
        true in case it is present at the given method, else false
      • isAnnotationPresent

        public boolean isAnnotationPresent​(Class<? extends Annotation> annotationType,
                                           org.glassfish.hk2.classmodel.reflect.Parameter parameter)
        Version of Parameter#isAnnotationPresent(Class) also considering annotations "inherited" from super-types.
        Parameters:
        annotationType - annotation type to check
        parameter - the parameter checked for annotations. The parameter must belong to a method defined or inherited by this getType()
        Returns:
        true in case it is present at the given parameter, else false
      • isAnnotationPresent

        public boolean isAnnotationPresent​(Class<? extends Annotation> annotationType,
                                           org.glassfish.hk2.classmodel.reflect.AnnotatedElement element)
        Version of AnnotatedElement#isAnnotationPresent(Class) also considering annotations "inherited" from super-types.
        Parameters:
        annotationType - annotation type to check
        element - must be this getType()'s Class or a Field or Method defined or inherited by it or a Parameter of such a method.
        Returns:
        true in case it is present at the given element, else false
      • getAnnotationCount

        public int getAnnotationCount​(org.glassfish.hk2.classmodel.reflect.Parameter parameter)
        Counts the annotation on a Parameter including those present on same parameter of an overridden method should the method be overridden.
        Parameters:
        parameter - the parameter of which to count annotations for
        Returns:
        the number of annotation present on the given Parameter including annotations present on the same parameter of an potentially overridden method.