Package javax.enterprise.util
Class AnnotationLiteral<T extends java.lang.annotation.Annotation>
- java.lang.Object
-
- javax.enterprise.util.AnnotationLiteral<T>
-
- Type Parameters:
T- the annotation type
- All Implemented Interfaces:
java.io.Serializable,java.lang.annotation.Annotation
- Direct Known Subclasses:
Alternative.Literal,Any.Literal,Default.Literal,InjectLiteral,NamedLiteral,Nonbinding.Literal,QualifierLiteral,SingletonLiteral,Specializes.Literal,TransientReference.Literal,Typed.Literal,Vetoed.Literal
public abstract class AnnotationLiteral<T extends java.lang.annotation.Annotation> extends java.lang.Object implements java.lang.annotation.Annotation, java.io.SerializableSupports inline instantiation of annotation type instances.
Reflection operations are using
SecurityActionsutility class to support security manager.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; } };
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.Class<T>annotationTypeprivate java.lang.IntegercachedHashCodeprivate java.lang.reflect.Method[]membersprivate static longserialVersionUID
-
Constructor Summary
Constructors Modifier Constructor Description protectedAnnotationLiteral()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Class<? extends java.lang.annotation.Annotation>annotationType()private voidappendInBraces(java.lang.StringBuilder buf, java.lang.String s)booleanequals(java.lang.Object other)private static java.lang.Class<?>getAnnotationLiteralSubclass(java.lang.Class<?> clazz)private java.lang.reflect.Method[]getMembers()private static java.lang.ObjectgetMemberValue(java.lang.reflect.Method member, java.lang.annotation.Annotation instance)private static <T> java.lang.Class<T>getTypeParameter(java.lang.Class<?> annotationLiteralSuperclass)inthashCode()private static java.lang.Objectinvoke(java.lang.reflect.Method method, java.lang.Object instance)java.lang.StringtoString()
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
annotationType
private transient java.lang.Class<T extends java.lang.annotation.Annotation> annotationType
-
members
private transient java.lang.reflect.Method[] members
-
cachedHashCode
private transient java.lang.Integer cachedHashCode
-
-
Method Detail
-
getMembers
private java.lang.reflect.Method[] getMembers()
-
getAnnotationLiteralSubclass
private static java.lang.Class<?> getAnnotationLiteralSubclass(java.lang.Class<?> clazz)
-
getTypeParameter
private static <T> java.lang.Class<T> getTypeParameter(java.lang.Class<?> annotationLiteralSuperclass)
-
annotationType
public java.lang.Class<? extends java.lang.annotation.Annotation> annotationType()
- Specified by:
annotationTypein interfacejava.lang.annotation.Annotation
-
toString
public java.lang.String toString()
- Specified by:
toStringin interfacejava.lang.annotation.Annotation- Overrides:
toStringin classjava.lang.Object
-
appendInBraces
private void appendInBraces(java.lang.StringBuilder buf, java.lang.String s)
-
equals
public boolean equals(java.lang.Object other)
- Specified by:
equalsin interfacejava.lang.annotation.Annotation- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Specified by:
hashCodein interfacejava.lang.annotation.Annotation- Overrides:
hashCodein classjava.lang.Object
-
getMemberValue
private static java.lang.Object getMemberValue(java.lang.reflect.Method member, java.lang.annotation.Annotation instance)
-
invoke
private static java.lang.Object invoke(java.lang.reflect.Method method, java.lang.Object instance)
-
-