org.hibernate.annotations.common.annotationfactory
public class AnnotationProxy extends java.lang.Object implements java.lang.annotation.Annotation, java.lang.reflect.InvocationHandler
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
.Annotation
Constructor and Description |
---|
AnnotationProxy(AnnotationDescriptor descriptor) |
Modifier and Type | Method and Description |
---|---|
java.lang.Class<? extends java.lang.annotation.Annotation> |
annotationType() |
java.lang.Object |
invoke(java.lang.Object proxy,
java.lang.reflect.Method method,
java.lang.Object[] args) |
java.lang.String |
toString() |
public AnnotationProxy(AnnotationDescriptor descriptor)
public java.lang.Object invoke(java.lang.Object proxy, java.lang.reflect.Method method, java.lang.Object[] args) throws java.lang.Throwable
invoke
in interface java.lang.reflect.InvocationHandler
java.lang.Throwable
public java.lang.Class<? extends java.lang.annotation.Annotation> annotationType()
annotationType
in interface java.lang.annotation.Annotation
public java.lang.String toString()
toString
in interface java.lang.annotation.Annotation
toString
in class java.lang.Object