Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.hibernate.annotationfactory
Class AnnotationProxy

    java.lang.Object
      org.hibernate.annotationfactory.AnnotationProxy

All Implemented Interfaces:
  java.lang.annotation.Annotation, InvocationHandler

    public class AnnotationProxy

extends Object
implements java.lang.annotation.Annotation, InvocationHandler

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.

Warning: this class does not implement `hashCode()` and `equals()` - it just uses the ones it inherits from `Object`. This means that an `AnnotationProxy` does not follow the recommendations of the `Annotation` javadoc about these two methods. That's why you should never mix `AnnotationProxies` with "real" annotations. For example, don't put them into the same `Collection`.

Author:
  Paolo Perrotta, Davide Marchignoli
See Also:
  `Annotation`

Constructor Summary
`AnnotationProxy(AnnotationDescriptor descriptor)`

Method Summary
`Class<? extends java.lang.annotation.Annotation>` | `annotationType()`
`Object` | `invoke(Object proxy, Method method, Object[] args)`
`String` | `toString()`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Methods inherited from interface java.lang.annotation.Annotation
`equals, hashCode`

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 java.lang.annotation.Annotation> annotationType()

  Specified by:
    `annotationType` in interface `java.lang.annotation.Annotation`

### toString

    public String toString()

  Specified by:
    `toString` in interface `java.lang.annotation.Annotation`
  Overrides:
    `toString` in class `Object`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD