This
class defines a simple but powerful API for dynamically generating a
proxy class. A proxy class implements a
specified list of interfaces and delegates invocations of the methods
defined by those interfaces to a separate invocation handler object.
The
static getProxyClass( ) method dynamically creates
a new Class object that implements each of the
interfaces specified in the supplied Class[ ]
array. The newly created class is defined in the context of the
specified ClassLoader. The
Class returned by getProxyClass(
) is a subclass of Proxy. Every class
that is dynamically generated by getProxyClass( )
has a single public constructor, which expects a single argument of
type InvocationHandler. You can create an instance
of the dynamic proxy class by using the
Constructor class to invoke this constructor. Or,
more simply, you can combine the call to getProxyClass(
) with the constructor call by calling the static
newProxyInstance(
) method, which both defines and
instantiates a proxy class.
Every instance of a dynamic proxy class has an associated
InvocationHandler object. All method calls made on a proxy
class are translated into calls to the invoke(
)
method of this InvocationHandler object, which can
handle the call in any way it sees fit. The static
getInvocationHandler(
) method returns the
InvocationHandler object for a given proxy object.
The static isProxyClass( ) method returns
true if a specified Class
object is a dynamically generated proxy class.

public class Proxy implements Serializable {
// Protected Constructors
protected Proxy(InvocationHandler h);
// Public Class Methods
public static InvocationHandler getInvocationHandler(Object proxy)
throws IllegalArgumentException;
public static Class<?> getProxyClass(ClassLoader loader, Class<?>
... interfaces) throws IllegalArgumentException;
public static boolean isProxyClass(Class<?> cl);
public static Object newProxyInstance(ClassLoader loader, Class<?>[ ]
interfaces, InvocationHandler h) throws IllegalArgumentException;
// Protected Instance Fields
protected InvocationHandler h;
}