org.hibernate.validator.internal.util.annotationfactory

## Class AnnotationProxy

- java.lang.Object
- - org.hibernate.validator.internal.util.annotationfactory.AnnotationProxy

- All Implemented Interfaces:
    Serializable, Annotation, InvocationHandler

      public class AnnotationProxy
      extends Object
      implements Annotation, InvocationHandler, Serializable

  A concrete implementation of `Annotation` that pretends it is a "real" source code annotation. It's also an `InvocationHandler`.

  When you create an `AnnotationProxy`, you must initialize it with an `AnnotationDescriptor`. The adapter checks that the provided elements are the same elements defined in the annotation interface. However, it does not check that their values are the right type. If you omit an element, the adapter will use the default value for that element from the annotation interface, if it exists. If no default exists, it will throw an exception.

  Author:
    Paolo Perrotta, Davide Marchignoli, Gunnar Morling
  See Also:
    `Annotation`, Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `AnnotationProxy(AnnotationDescriptor<?> descriptor)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `Class<? extends Annotation>` | `annotationType()`
    `boolean` | `equals(Object obj)` Performs an equality check as described in `Annotation.equals(Object)`.
    `int` | `hashCode()` Calculates the hash code of this annotation proxy as described in `Annotation.hashCode()`.
    `Object` | `invoke(Object proxy, Method method, Object[] args)`
    `String` | `toString()`

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### AnnotationProxy

          public AnnotationProxy(AnnotationDescriptor<?> descriptor)

  - ### Method Detail

    - #### invoke

          public Object invoke(Object proxy,
                      Method method,
                      Object[] args)
                        throws Throwable

      Specified by:
        `invoke` in interface `InvocationHandler`
      Throws:
        `Throwable`

    - #### annotationType

          public Class<? extends Annotation> annotationType()

      Specified by:
        `annotationType` in interface `Annotation`

    - #### equals

          public boolean equals(Object obj)

      Performs an equality check as described in `Annotation.equals(Object)`.
      Specified by:
        `equals` in interface `Annotation`
      Overrides:
        `equals` in class `Object`
      Parameters:
        `obj` - The object to compare
      Returns:
        Whether the given object is equal to this annotation proxy or not
      See Also:
        `Annotation.equals(Object)`

    - #### hashCode

          public int hashCode()

      Calculates the hash code of this annotation proxy as described in `Annotation.hashCode()`.
      Specified by:
        `hashCode` in interface `Annotation`
      Overrides:
        `hashCode` in class `Object`
      Returns:
        The hash code of this proxy.
      See Also:
        `Annotation.hashCode()`

    - #### toString

          public String toString()

      Specified by:
        `toString` in interface `Annotation`
      Overrides:
        `toString` in class `Object`

Copyright © 2007-2014 Red Hat, Inc. All Rights Reserved