java.lang.reflect |
Provides classes and interfaces for obtaining reflective
information about classes and objects. |
Java Source File Name | Type | Comment |
AccessibleObject.java | Class | The AccessibleObject class is the base class for Field, Method and
Constructor objects. |
AnnotatedElement.java | Interface | Represents an annotated element of the program currently running in this
VM. |
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. |
GenericArrayType.java | Interface | GenericArrayType represents an array type whose component
type is either a parameterized type or a type variable. |
GenericDeclaration.java | Interface | A common interface for all entities that declare type variables. |
GenericSignatureFormatError.java | Class | Thrown when a syntactically malformed signature attribute is
encountered by a reflective method that needs to interpret the
generic signature information for a type, method or constructor. |
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. |
MalformedParameterizedTypeException.java | Class | Thrown when a semantically malformed parameterized type is
encountered by a reflective method that needs to instantiate it. |
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. |
package-info.java | | |
ParameterizedType.java | Interface | ParameterizedType represents a parameterized type such as
Collection<String>.
A parameterized type is created the first time it is needed by a
reflective method, as specified in this package. |
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. |
ReflectAccess.java | Class | Package-private class implementing the
sun.reflect.LangReflectAccess interface, allowing the java.lang
package to instantiate objects in this package. |
ReflectPermission.java | Class | The Permission class for reflective operations. |
Type.java | Interface | Type is the common superinterface for all types in the Java
programming language. |
TypeVariable.java | Interface | TypeVariable is the common superinterface for type variables of kinds.
A type variable is created the first time it is needed by a reflective
method, as specified in this package. |
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. |
WildcardType.java | Interface | WildcardType represents a wildcard type expression, such as
? ,
? extends Number , or
? super Integer . |