Class AnnotationLiteral<T extends Annotation>

java.lang.Object
org.glassfish.jersey.internal.inject.AnnotationLiteral<T>
Type Parameters:
T - the annotation type
All Implemented Interfaces:
Serializable, Annotation
Direct Known Subclasses:
BackgroundSchedulerLiteral, ClientAsyncExecutorLiteral, ClientBackgroundSchedulerLiteral, CustomAnnotationLiteral, ManagedAsyncExecutorLiteral, SecurityAnnotations.DenyAllImpl, SecurityAnnotations.PermitAllImpl, SecurityAnnotations.RolesAllowedImpl

public abstract class AnnotationLiteral<T extends Annotation> extends Object implements Annotation, Serializable
Supports inline instantiation of annotation type instances.

An instance of an annotation type may be obtained by subclassing AnnotationLiteral.

 public abstract class PayByQualifier
       extends AnnotationLiteral<PayBy>
       implements PayBy {}
 
An extension of AnnotationLiteral must do two things:
  1. Must have the target annotation as its generic type
  2. Must implement the target type
In particular, in-line anonymous extensions of AnnotationLiteral will not work because in-line anonymous extensions of AnnotationLiteral cannot implement the target annotation
See Also:
  • Field Details

    • serialVersionUID

      private static final long serialVersionUID
      See Also:
    • annotationType

      private transient Class<T extends Annotation> annotationType
    • members

      private transient Method[] members
  • Constructor Details

    • AnnotationLiteral

      protected AnnotationLiteral()
  • Method Details

    • getAnnotationLiteralSubclass

      private static Class<?> getAnnotationLiteralSubclass(Class<?> clazz)
    • getTypeParameter

      private static <T> Class<T> getTypeParameter(Class<?> annotationLiteralSuperclass)
    • setAccessible

      private static void setAccessible(AccessibleObject ao)
    • invoke

      private static Object invoke(Method method, Object instance)
    • getMembers

      private Method[] getMembers()
    • annotationType

      public Class<? extends Annotation> annotationType()
      Method returns the type of the annotation literal. The value is resolved lazily during the first call of this method.
      Specified by:
      annotationType in interface Annotation
      Returns:
      annotation type of this literal.
    • equals

      public boolean equals(Object other)
      Specified by:
      equals in interface Annotation
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Specified by:
      hashCode in interface Annotation
      Overrides:
      hashCode in class Object