Package com.strobel.reflection.emit
Class AnnotationInvocationHandler
java.lang.Object
com.strobel.reflection.emit.AnnotationInvocationHandler
- All Implemented Interfaces:
Serializable
,InvocationHandler
InvocationHandler for dynamic proxy implementation of Annotation.
- Since:
- 1.5
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate Method[]
private static final long
private final Class
<? extends Annotation> -
Constructor Summary
ConstructorsConstructorDescriptionAnnotationInvocationHandler
(Class<? extends Annotation> type, Map<String, Object> memberValues) -
Method Summary
Modifier and TypeMethodDescriptionprivate AnnotationInvocationHandler
Returns an object's invocation handler if that object is a dynamic proxy with a handler of type AnnotationInvocationHandler.private static Object
cloneArray
(Object array) This method, which clones its array argument, would not be necessary if Cloneable had a public clone method.private Boolean
equalsImpl
(Object o) Implementation of dynamicProxy.equals(Object o)private Method[]
Returns the member methods for our annotation type.private int
Implementation of dynamicProxy.hashCode()private static boolean
memberValueEquals
(Object v1, Object v2) Returns true iff the two member values in "dynamic proxy return form" are equal using the appropriate equality function depending on the member type.private static int
memberValueHashCode
(Object value) Computes hashCode of a member value (in "dynamic proxy return form")private static String
memberValueToString
(Object value) Translates a member value (in "dynamic proxy return form") into a stringprivate void
private String
Implementation of dynamicProxy.toString()
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
type
-
memberValues
-
memberMethods
-
-
Constructor Details
-
AnnotationInvocationHandler
AnnotationInvocationHandler(Class<? extends Annotation> type, Map<String, Object> memberValues)
-
-
Method Details
-
invoke
- Specified by:
invoke
in interfaceInvocationHandler
-
cloneArray
This method, which clones its array argument, would not be necessary if Cloneable had a public clone method. -
toStringImpl
Implementation of dynamicProxy.toString() -
memberValueToString
Translates a member value (in "dynamic proxy return form") into a string -
equalsImpl
Implementation of dynamicProxy.equals(Object o) -
asOneOfUs
Returns an object's invocation handler if that object is a dynamic proxy with a handler of type AnnotationInvocationHandler. Returns null otherwise. -
memberValueEquals
Returns true iff the two member values in "dynamic proxy return form" are equal using the appropriate equality function depending on the member type. The two values will be of the same type unless one of the containing annotations is ill-formed. If one of the containing annotations is ill-formed, this method will return false unless the two members are identical object references. -
getMemberMethods
Returns the member methods for our annotation type. These are obtained lazily and cached, as they're expensive to obtain, and we only need them if our `equals` method is invoked (which should be rare). -
hashCodeImpl
private int hashCodeImpl()Implementation of dynamicProxy.hashCode() -
memberValueHashCode
Computes hashCode of a member value (in "dynamic proxy return form") -
readObject
- Throws:
IOException
ClassNotFoundException
-