Class AnnotationLiteral<T extends java.lang.annotation.Annotation>

  • Type Parameters:
    T - the annotation type
    All Implemented Interfaces:, java.lang.annotation.Annotation
    Direct Known Subclasses:

    public abstract class AnnotationLiteral<T extends java.lang.annotation.Annotation>
    extends java.lang.Object
    implements java.lang.annotation.Annotation,

    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 {
     PayBy paybyCheque = new PayByQualifier() {
         public PaymentMethod value() {
             return CHEQUE;
    See Also:,, Serialized Form
    • Constructor Summary

      Modifier Constructor Description
      protected AnnotationLiteral​()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.Class<? extends java.lang.annotation.Annotation> annotationType​()  
      boolean equals​(java.lang.Object other)  
      int hashCode​()  
      java.lang.String toString​()  
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • AnnotationLiteral

        protected AnnotationLiteral​()
    • Method Detail

      • annotationType

        public java.lang.Class<? extends java.lang.annotation.Annotation> annotationType​()
        Specified by:
        annotationType in interface java.lang.annotation.Annotation
      • toString

        public java.lang.String toString​()
        Specified by:
        toString in interface java.lang.annotation.Annotation
        toString in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object other)
        Specified by:
        equals in interface java.lang.annotation.Annotation
        equals in class java.lang.Object
      • hashCode

        public int hashCode​()
        Specified by:
        hashCode in interface java.lang.annotation.Annotation
        hashCode in class java.lang.Object