public class AnnotationImpl
extends java.lang.Object
implements java.lang.reflect.InvocationHandler
toAnnotationType()
in Annotation
.Modifier and Type | Field and Description |
---|---|
private Annotation |
annotation |
private java.lang.Class |
annotationType |
private int |
cachedHashCode |
private java.lang.ClassLoader |
classLoader |
private static java.lang.String |
JDK_ANNOTATION_CLASS_NAME |
private static java.lang.reflect.Method |
JDK_ANNOTATION_TYPE_METHOD |
private ClassPool |
pool |
Modifier | Constructor and Description |
---|---|
private |
AnnotationImpl(Annotation a,
ClassPool cp,
java.lang.ClassLoader loader) |
Modifier and Type | Method and Description |
---|---|
private static int |
arrayHashCode(java.lang.Object object)
Calculates the hashCode of an array using the same
algorithm as java.util.Arrays.hashCode()
|
private boolean |
checkEquals(java.lang.Object obj)
Check that another annotation equals ourselves.
|
Annotation |
getAnnotation()
Obtains the internal data structure representing the annotation.
|
private java.lang.Class |
getAnnotationType()
Get the annotation type
|
private java.lang.Object |
getDefault(java.lang.String name,
java.lang.reflect.Method method) |
java.lang.String |
getTypeName()
Obtains the name of the annotation type.
|
int |
hashCode()
Returns a hash code value for this object.
|
java.lang.Object |
invoke(java.lang.Object proxy,
java.lang.reflect.Method method,
java.lang.Object[] args)
Executes a method invocation on a proxy instance.
|
static java.lang.Object |
make(java.lang.ClassLoader cl,
java.lang.Class clazz,
ClassPool cp,
Annotation anon)
Constructs an annotation object.
|
private static final java.lang.String JDK_ANNOTATION_CLASS_NAME
private static java.lang.reflect.Method JDK_ANNOTATION_TYPE_METHOD
private Annotation annotation
private ClassPool pool
private java.lang.ClassLoader classLoader
private transient java.lang.Class annotationType
private transient int cachedHashCode
private AnnotationImpl(Annotation a, ClassPool cp, java.lang.ClassLoader loader)
public static java.lang.Object make(java.lang.ClassLoader cl, java.lang.Class clazz, ClassPool cp, Annotation anon)
cl
- class loader for obtaining annotation types.clazz
- the annotation type.cp
- class pool for containing an annotation
type (or null).anon
- the annotation.public java.lang.String getTypeName()
private java.lang.Class getAnnotationType()
java.lang.NoClassDefFoundError
- when the class could not loadedpublic Annotation getAnnotation()
public java.lang.Object invoke(java.lang.Object proxy, java.lang.reflect.Method method, java.lang.Object[] args) throws java.lang.Throwable
toString()
, equals()
,
and hashCode()
are directly supplied by the
AnnotationImpl
. The annotationType()
method
is also available on the proxy instance.invoke
in interface java.lang.reflect.InvocationHandler
java.lang.Throwable
private java.lang.Object getDefault(java.lang.String name, java.lang.reflect.Method method) throws java.lang.ClassNotFoundException, java.lang.RuntimeException
java.lang.ClassNotFoundException
java.lang.RuntimeException
public int hashCode()
hashCode
in class java.lang.Object
private boolean checkEquals(java.lang.Object obj) throws java.lang.Exception
obj
- the other annotationjava.lang.Exception
- for any problemprivate static int arrayHashCode(java.lang.Object object)
object
- the object