Package javassist.bytecode.annotation
Class AnnotationImpl
java.lang.Object
javassist.bytecode.annotation.AnnotationImpl
- All Implemented Interfaces:
InvocationHandler
Internal-use only. This is a helper class internally used for implementing
toAnnotationType()
in Annotation
.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate Annotation
private Class
<?> private int
private ClassLoader
private static final String
private static Method
private ClassPool
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprivate
AnnotationImpl
(Annotation a, ClassPool cp, ClassLoader loader) -
Method Summary
Modifier and TypeMethodDescriptionprivate static int
arrayHashCode
(Object object) Calculates the hashCode of an array using the same algorithm as java.util.Arrays.hashCode()private boolean
checkEquals
(Object obj) Check that another annotation equals ourselves.Obtains the internal data structure representing the annotation.private Class
<?> Get the annotation typeprivate Object
getDefault
(String name, Method method) Obtains the name of the annotation type.int
hashCode()
Returns a hash code value for this object.Executes a method invocation on a proxy instance.static Object
make
(ClassLoader cl, Class<?> clazz, ClassPool cp, Annotation anon) Constructs an annotation object.
-
Field Details
-
JDK_ANNOTATION_CLASS_NAME
- See Also:
-
JDK_ANNOTATION_TYPE_METHOD
-
annotation
-
pool
-
classLoader
-
annotationType
-
cachedHashCode
private transient int cachedHashCode
-
-
Constructor Details
-
AnnotationImpl
-
-
Method Details
-
make
public static Object make(ClassLoader cl, Class<?> clazz, ClassPool cp, Annotation anon) throws IllegalArgumentException Constructs an annotation object.- Parameters:
cl
- class loader for obtaining annotation types.clazz
- the annotation type.cp
- class pool for containing an annotation type (or null).anon
- the annotation.- Returns:
- the annotation
- Throws:
IllegalArgumentException
-
getTypeName
Obtains the name of the annotation type.- Returns:
- the type name
-
getAnnotationType
Get the annotation type- Returns:
- the annotation class
- Throws:
NoClassDefFoundError
- when the class could not loaded
-
getAnnotation
Obtains the internal data structure representing the annotation.- Returns:
- the annotation
-
invoke
Executes a method invocation on a proxy instance. The implementations oftoString()
,equals()
, andhashCode()
are directly supplied by theAnnotationImpl
. TheannotationType()
method is also available on the proxy instance.- Specified by:
invoke
in interfaceInvocationHandler
- Throws:
Throwable
-
getDefault
private Object getDefault(String name, Method method) throws ClassNotFoundException, RuntimeException -
hashCode
public int hashCode()Returns a hash code value for this object. -
checkEquals
Check that another annotation equals ourselves.- Parameters:
obj
- the other annotation- Returns:
- the true when equals false otherwise
- Throws:
Exception
- for any problem
-
arrayHashCode
Calculates the hashCode of an array using the same algorithm as java.util.Arrays.hashCode()- Parameters:
object
- the object- Returns:
- the hashCode
-