Class Overview
Proxy
defines methods for creating dynamic proxy classes and instances.
A proxy class implements a declared set of interfaces and delegates method
invocations to an InvocationHandler
.
Summary
Fields |
protected
InvocationHandler |
h |
The invocation handler on which the method calls are dispatched. |
Protected Constructors |
|
Proxy(InvocationHandler h)
Constructs a new Proxy instance with the specified invocation
handler.
|
[Expand]
Inherited Methods |
From class
java.lang.Object
Object
|
clone()
Creates and returns a copy of this Object .
|
boolean
|
equals(Object o)
Compares this instance with the specified object and indicates if they
are equal.
|
void
|
finalize()
Called before the object's memory is reclaimed by the VM.
|
final
Class<?>
|
getClass()
Returns the unique instance of Class that represents this
object's class.
|
int
|
hashCode()
Returns an integer hash code for this object.
|
final
void
|
notify()
Causes a thread which is waiting on this object's monitor (by means of
calling one of the wait() methods) to be woken up.
|
final
void
|
notifyAll()
Causes all threads which are waiting on this object's monitor (by means
of calling one of the wait() methods) to be woken up.
|
String
|
toString()
Returns a string containing a concise, human-readable description of this
object.
|
final
void
|
wait()
Causes the calling thread to wait until another thread calls the notify() or notifyAll() method of this object.
|
final
void
|
wait(long millis, int nanos)
Causes the calling thread to wait until another thread calls the notify() or notifyAll() method of this object or until the
specified timeout expires.
|
final
void
|
wait(long millis)
Causes the calling thread to wait until another thread calls the notify() or notifyAll() method of this object or until the
specified timeout expires.
|
|
Fields
The invocation handler on which the method calls are dispatched.
Protected Constructors
Constructs a new Proxy
instance with the specified invocation
handler.
Parameters
h
| the invocation handler for the newly created proxy
|
Public Methods
Returns the invocation handler of the specified proxy instance.
Returns
- the invocation handler of the specified proxy instance
public
static
Class<?>
getProxyClass
(ClassLoader loader, Class...<?> interfaces)
Returns the dynamically built Class
for the specified interfaces.
Creates a new Class
when necessary. The order of the interfaces
is relevant. Invocations of this method with the same interfaces but
different order result in different generated classes. 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 will be implemented by the returned proxy
class |
Returns
- a proxy class that implements all of the interfaces referred to
in the contents of
interfaces
public
static
boolean
isProxyClass
(Class<?> cl)
Indicates whether or not the specified class is a dynamically generated
proxy class.
Returns
true
if the class is a proxy class, false
otherwise
Returns an instance of the dynamically built class for the specified
interfaces. Method invocations on the returned instance are forwarded 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
| an array of Class objects, each one identifying an
interface that will be implemented by the returned proxy
object |
h
| the invocation handler that handles the dispatched method
invocations |
Returns
- a new proxy object that delegates to the handler
h