java.lang.reflect |
|
Java Source File Name | Type | Comment |
AccessibleObject.java | Class | The AccessibleObject class is the base class for Field, Method and
Constructor objects. |
Array.java | Class | The Array class provides static methods to dynamically create and
access Java arrays. |
Constructor.java | Class | Constructor provides information about, and access to, a single
constructor for a class. |
Field.java | Class | A Field provides information about, and dynamic access to, a
single field of a class or an interface. |
InvocationHandler.java | Interface | InvocationHandler is the interface implemented by
the invocation handler of a proxy instance. |
InvocationTargetException.java | Class | InvocationTargetException is a checked exception that wraps
an exception thrown by an invoked method or constructor.
As of release 1.4, this exception has been retrofitted to conform to
the general purpose exception-chaining mechanism. |
Member.java | Interface | Member is an interface that reflects identifying information about
a single member (a field or a method) or a constructor. |
Method.java | Class | A Method provides information about, and access to, a single method
on a class or interface. |
Modifier.java | Class | The Modifier class provides static methods and
constants to decode class and member access modifiers. |
Proxy.java | Class | Proxy provides static methods for creating dynamic proxy
classes and instances, and it is also the superclass of all
dynamic proxy classes created by those methods.
To create a proxy for some interface Foo :
InvocationHandler handler = new MyInvocationHandler(...);
Class proxyClass = Proxy.getProxyClass(
Foo.class.getClassLoader(), new Class[] { Foo.class });
Foo f = (Foo) proxyClass.
getConstructor(new Class[] { InvocationHandler.class }).
newInstance(new Object[] { handler });
or more simply:
Foo f = (Foo) Proxy.newProxyInstance(Foo.class.getClassLoader(),
new Class[] { Foo.class },
handler);
A dynamic proxy class (simply referred to as a proxy
class below) is a class that implements a list of interfaces
specified at runtime when the class is created, with behavior as
described below.
A proxy interface is such an interface that is implemented
by a proxy class.
A proxy instance is an instance of a proxy class.
Each proxy instance has an associated invocation handler
object, which implements the interface
InvocationHandler .
A method invocation on a proxy instance through one of its proxy
interfaces will be dispatched to the
InvocationHandler.invokeinvoke method of the instance's invocation handler, passing the proxy
instance, a java.lang.reflect.Method object identifying
the method that was invoked, and an array of type Object
containing the arguments. |
ReflectPermission.java | Class | The Permission class for reflective operations. |
UndeclaredThrowableException.java | Class | Thrown by a method invocation on a proxy instance if its invocation
handler's
InvocationHandler.invoke invoke method throws a
checked exception (a Throwable that is not assignable
to RuntimeException or Error ) that
is not assignable to any of the exception types declared in the
throws clause of the method that was invoked on the
proxy instance and dispatched to the invocation handler.
An UndeclaredThrowableException instance contains
the undeclared checked exception that was thrown by the invocation
handler, and it can be retrieved with the
getUndeclaredThrowable() method.
UndeclaredThrowableException extends
RuntimeException , so it is an unchecked exception
that wraps a checked exception.
As of release 1.4, this exception has been retrofitted to
conform to the general purpose exception-chaining mechanism. |