java.lang.reflect.Proxy
This class provides methods to creating dynamic proxy classes and instances.
Summary
Fields
Protected Constructors
Public Methods
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait
Details
Fields
Protected Constructors
Public Methods
Return the proxy instance's invocation handler.
Parameters
proxy
| the proxy instance. |
Returns
- the proxy's invocation handler object
public
static
Class<?>
getProxyClass(ClassLoader loader, Class[]<?> interfaces)
Return the dynamically build class for the given interfaces, build a new
one when necessary. The order of the interfaces is important.
The interfaces must be visible from the supplied class loader; no
duplicates are permitted. All non-public interfaces must be defined in
the same package.
Parameters
loader
| the class loader that will define the proxy class. |
interfaces
| an array of Class objects, each one identifying
an interface that the new proxy must implement |
Returns
- a proxy class that implements all of the interfaces referred to
in the contents of
interfaces
.
public
static
boolean
isProxyClass(Class<?> cl)
Return whether the supplied class is a dynamically generated proxy class.
Returns
- true if the class is a proxy class and false otherwise.
Return an instance of the dynamically build class for the given
interfaces that forwards methods to the specified invocation handler.
The interfaces must be visible from the supplied class loader; no
duplicates are permitted. All non-public interfaces must be defined in
the same package.
Parameters
loader
| the class loader that will define the proxy class. |
interfaces
| the list of interfaces to implement. |
h
| the invocation handler for the forwarded methods. |
Returns
- a new proxy object that delegates to the handler
h