Class AnnotationInvocationHandler

java.lang.Object
com.strobel.reflection.emit.AnnotationInvocationHandler
All Implemented Interfaces:
Serializable, InvocationHandler

final class AnnotationInvocationHandler extends Object implements InvocationHandler, Serializable
InvocationHandler for dynamic proxy implementation of Annotation.
Since:
1.5
  • Field Details

  • Constructor Details

  • Method Details

    • invoke

      public Object invoke(Object proxy, Method method, Object[] args)
      Specified by:
      invoke in interface InvocationHandler
    • cloneArray

      private static Object cloneArray(Object array)
      This method, which clones its array argument, would not be necessary if Cloneable had a public clone method.
    • toStringImpl

      private String toStringImpl()
      Implementation of dynamicProxy.toString()
    • memberValueToString

      private static String memberValueToString(Object value)
      Translates a member value (in "dynamic proxy return form") into a string
    • equalsImpl

      private Boolean equalsImpl(Object o)
      Implementation of dynamicProxy.equals(Object o)
    • asOneOfUs

      private AnnotationInvocationHandler asOneOfUs(Object o)
      Returns an object's invocation handler if that object is a dynamic proxy with a handler of type AnnotationInvocationHandler. Returns null otherwise.
    • memberValueEquals

      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. 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

      private Method[] 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

      private static int memberValueHashCode(Object value)
      Computes hashCode of a member value (in "dynamic proxy return form")
    • readObject

      private void readObject(ObjectInputStream s) throws IOException, ClassNotFoundException
      Throws:
      IOException
      ClassNotFoundException