Skip navigation links

Oracle Fusion Middleware Java API Reference for Oracle TopLink
11g Release 1 (11.1.1)

E28847-01


org.eclipse.persistence.jaxb.javamodel
Class AnnotationProxy

java.lang.Object
  extended by org.eclipse.persistence.jaxb.javamodel.AnnotationProxy

All Implemented Interfaces:
java.lang.reflect.InvocationHandler

public class AnnotationProxy
extends java.lang.Object
implements java.lang.reflect.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:

This class provides a means to invoke JDK Annotation method calls on a non Annotation instance.

See Also:
Proxy

Field Summary
private static java.lang.String ANNOTATION_TYPE_METHOD_NAME
           
private  java.util.Map<java.lang.String,java.lang.Object> components
           
private  org.eclipse.persistence.internal.helper.ConversionManager conversionMgr
           

 

Constructor Summary
private AnnotationProxy(java.util.Map<java.lang.String,java.lang.Object> components, org.eclipse.persistence.internal.helper.ConversionManager conversionMgr)
          This constructor sets the Map of components (method name to value pairs)and the ConversionManager to be used when converting values in the Map based on the return type of the associated Method Note that the preferred method of obtaining an instance of this proxy class is via getProxy(Map, Class, ClassLoader, ConversionManager)

 

Method Summary
 java.util.Map<java.lang.String,java.lang.Object> getComponents()
          Return the Map of method name/value pairs for this proxy instance.
static
<A extends java.lang.annotation.Annotation>
A
getProxy(java.util.Map<java.lang.String,java.lang.Object> components, java.lang.Class<A> annoClass, java.lang.ClassLoader cl, org.eclipse.persistence.internal.helper.ConversionManager conversionMgr)
          This is the preferred way to obtain an instance of a dynamic proxy.
private  java.lang.Object handleArrayData(java.lang.Class returnType, java.lang.Object value)
           
 java.lang.Object invoke(java.lang.Object proxy, java.lang.reflect.Method method, java.lang.Object[] args)
          Invoke a given Method on this proxy.

 

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

 

Field Detail

components

private java.util.Map<java.lang.String,java.lang.Object> components

conversionMgr

private org.eclipse.persistence.internal.helper.ConversionManager conversionMgr

ANNOTATION_TYPE_METHOD_NAME

private static final java.lang.String ANNOTATION_TYPE_METHOD_NAME
See Also:
Constant Field Values

Constructor Detail

AnnotationProxy

private AnnotationProxy(java.util.Map<java.lang.String,java.lang.Object> components,
                        org.eclipse.persistence.internal.helper.ConversionManager conversionMgr)
This constructor sets the Map of components (method name to value pairs)and the ConversionManager to be used when converting values in the Map based on the return type of the associated Method Note that the preferred method of obtaining an instance of this proxy class is via getProxy(Map, Class, ClassLoader, ConversionManager)
Parameters:
components - Map of method name to value pairs
conversionMgr - ConversionManager instance for converting to the correct return type in the invoke method

Method Detail

getProxy

public static <A extends java.lang.annotation.Annotation> A getProxy(java.util.Map<java.lang.String,java.lang.Object> components,
                                                                     java.lang.Class<A> annoClass,
                                                                     java.lang.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 a ClassLoader (which is used to load the target Annotation), a Class (which indicates the target Annotation, i.e. javax.xml.bind.annotation.XmlElement.class), and a Map of method name to value pairs, which represent the method names on the Annotation and the values that are to be returned from each method call. For example, if this proxy is to be used for an @XmlElement, the Map should contain the following keys: Following are example key/value pairs :
Parameters:
components - Map of method name/value pairs for this proxy instance
annoClass - The interface for the proxy class to implement
cl - The ClassLoader to define the proxy class
conversionMgr - ConversionManager instance for converting to the correct return type in the invoke method
Returns:
A dynamic proxy instance based on a Java model JavaAnnotation

getComponents

public java.util.Map<java.lang.String,java.lang.Object> getComponents()
Return the Map of method name/value pairs for this proxy instance.
Returns:
Map of method name/value pairs for this proxy instance

invoke

public java.lang.Object invoke(java.lang.Object proxy,
                               java.lang.reflect.Method method,
                               java.lang.Object[] args)
                        throws java.lang.Throwable
Invoke a given Method on this proxy. The component Map will be accessed using the given Method's name, and if an entry exists, the associated value is returned.
Specified by:
invoke in interface java.lang.reflect.InvocationHandler
Parameters:
proxy - Satisfy the InvocationHandler interface - not used
method - The Method instance corresponding to the interface method invoked on the proxy instance
args - Satisfy the InvocationHandler interface - not used
Returns:
The value from the method invocation on the proxy instance
Throws:
java.lang.Throwable

handleArrayData

private java.lang.Object handleArrayData(java.lang.Class returnType,
                                         java.lang.Object value)

Skip navigation links

Copyright © 1998, 2012, Oracle. All Rights Reserved.