Class AnnotationProxy
java.lang.Object
org.eclipse.persistence.jaxb.javamodel.AnnotationProxy
- All Implemented Interfaces:
InvocationHandler
Purpose:The purpose of this class is to act as a dynamic proxy that allows JDK Annotation method calls to be made on a non Annotation object.
Responsibilities:
- Create and return a dynamic proxy instance based on an Annotation class
and a
Mapof components (method name to value pairs) - Allow JDK Annotation method calls to be invoked on the proxy object
This class provides a means to invoke JDK Annotation method calls on a non Annotation instance.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionReturn theMapof method name/value pairs for this proxy instance.static <A extends Annotation>
AgetProxy(Map<String, Object> components, Class<A> annoClass, ClassLoader cl, org.eclipse.persistence.internal.helper.ConversionManager conversionMgr) This is the preferred way to obtain an instance of a dynamic proxy.Invoke a givenMethodon this proxy.
-
Method Details
-
getProxy
public static <A extends Annotation> A getProxy(Map<String, Object> components, Class<A> annoClass, ClassLoader cl, org.eclipse.persistence.internal.helper.ConversionManager conversionMgr) This is the preferred way to obtain an instance of a dynamic proxy. The method takes aClassLoader(which is used to load the targetAnnotation), aClass(which indicates the targetAnnotation, i.e.jakarta.xml.bind.annotation.XmlElement.class), and aMapof method name to value pairs, which represent the method names on theAnnotationand the values that are to be returned from each method call. For example, if this proxy is to be used for an@XmlElement, theMapshould contain the following keys:- defaultValue
- name
- namespace
- nillable
- required
- type
- "defaultValue", "##default"
- "name", "employee"
- "namespace", "www.example.org"
- "nillable", false
- "required", false
- "type", jakarta.xml.bind.annotation.XmlElement.DEFAULT.class
- Parameters:
components-Mapof method name/value pairs for this proxy instanceannoClass- The interface for the proxy class to implementcl- TheClassLoaderto define the proxy classconversionMgr-ConversionManagerinstance for converting to the correct return type in theinvokemethod- Returns:
- A dynamic proxy instance based on a Java model JavaAnnotation
-
getComponents
Return theMapof method name/value pairs for this proxy instance.- Returns:
Mapof method name/value pairs for this proxy instance
-
invoke
Invoke a givenMethodon this proxy. The componentMapwill be accessed using the givenMethod's name, and if an entry exists, the associated value is returned.- Specified by:
invokein interfaceInvocationHandler- Parameters:
proxy- Satisfy theInvocationHandlerinterface - not usedmethod- TheMethodinstance corresponding to the interface method invoked on the proxy instanceargs- Satisfy theInvocationHandlerinterface - not used- Returns:
- The value from the method invocation on the proxy instance
- Throws:
Throwable
-