Class AnnotationProxy
- java.lang.Object
-
- org.hibernate.annotations.common.annotationfactory.AnnotationProxy
-
- All Implemented Interfaces:
Annotation,InvocationHandler
public final class AnnotationProxy extends Object implements Annotation, InvocationHandler
A concrete implementation ofAnnotationthat pretends it is a "real" source code annotation. It's also anInvocationHandler. When you create anAnnotationProxy, you must initialize it with anAnnotationDescriptor. 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 implementhashCode()andequals()- it just uses the ones it inherits fromObject. This means that anAnnotationProxydoes not follow the recommendations of theAnnotationjavadoc about these two methods. That's why you should never mixAnnotationProxieswith "real" annotations. For example, don't put them into the sameCollection.- See Also:
Annotation
-
-
Constructor Summary
Constructors Constructor Description AnnotationProxy(AnnotationDescriptor descriptor)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Class<? extends Annotation>annotationType()Objectinvoke(Object proxy, Method method, Object[] args)StringtoString()-
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:
invokein interfaceInvocationHandler- Throws:
Throwable
-
annotationType
public Class<? extends Annotation> annotationType()
- Specified by:
annotationTypein interfaceAnnotation
-
toString
public String toString()
- Specified by:
toStringin interfaceAnnotation- Overrides:
toStringin classObject
-
-