T
- the annotation typepublic abstract class AnnotationLiteral<T extends java.lang.annotation.Annotation>
extends java.lang.Object
implements java.lang.annotation.Annotation, java.io.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 { }
PayBy paybyCheque = new PayByQualifier() { public PaymentMethod value() { return CHEQUE; } };
Modifier and Type | Field and Description |
---|---|
private java.lang.Class<T> |
annotationType |
private java.lang.Integer |
cachedHashCode |
private java.lang.reflect.Method[] |
members |
private static long |
serialVersionUID |
Modifier | Constructor and Description |
---|---|
protected |
AnnotationLiteral() |
Modifier and Type | Method and Description |
---|---|
java.lang.Class<? extends java.lang.annotation.Annotation> |
annotationType() |
private void |
appendInBraces(java.lang.StringBuilder buf,
java.lang.String s) |
boolean |
equals(java.lang.Object other) |
private static java.lang.Class<?> |
getAnnotationLiteralSubclass(java.lang.Class<?> clazz) |
private java.lang.reflect.Method[] |
getMembers() |
private static java.lang.Object |
getMemberValue(java.lang.reflect.Method member,
java.lang.annotation.Annotation instance) |
private static <T> java.lang.Class<T> |
getTypeParameter(java.lang.Class<?> annotationLiteralSuperclass) |
int |
hashCode() |
private static java.lang.Object |
invoke(java.lang.reflect.Method method,
java.lang.Object instance) |
java.lang.String |
toString() |
private static final long serialVersionUID
private transient java.lang.Class<T extends java.lang.annotation.Annotation> annotationType
private transient java.lang.reflect.Method[] members
private transient java.lang.Integer cachedHashCode
private java.lang.reflect.Method[] getMembers()
private static java.lang.Class<?> getAnnotationLiteralSubclass(java.lang.Class<?> clazz)
private static <T> java.lang.Class<T> getTypeParameter(java.lang.Class<?> annotationLiteralSuperclass)
public java.lang.Class<? extends java.lang.annotation.Annotation> annotationType()
annotationType
in interface java.lang.annotation.Annotation
public java.lang.String toString()
toString
in interface java.lang.annotation.Annotation
toString
in class java.lang.Object
private void appendInBraces(java.lang.StringBuilder buf, java.lang.String s)
public boolean equals(java.lang.Object other)
equals
in interface java.lang.annotation.Annotation
equals
in class java.lang.Object
public int hashCode()
hashCode
in interface java.lang.annotation.Annotation
hashCode
in class java.lang.Object
private static java.lang.Object getMemberValue(java.lang.reflect.Method member, java.lang.annotation.Annotation instance)
private static java.lang.Object invoke(java.lang.reflect.Method method, java.lang.Object instance)