Generated by
JDiff

java.lang.reflect Documentation Differences

This file contains all the changes in documentation in the package java.lang.reflect as colored differences. Deletions are shown like this, and additions are shown like this.
If no deletions or additions are shown in an entry, the HTML tags will be what has changed. The new HTML tags are shown in the differences. If no documentation existed, and then some was added in a later version, this change is noted in the appropriate class pages of differences, but the change is not shown on this page. Only changes in existing text are shown here. Similarly, documentation which was inherited from another class or interface is not shown here.
Note that an HTML error in the new documentation may cause the display of other documentation changes to be presented incorrectly. For instance, failure to close a <code> tag will cause all subsequent paragraphs to be displayed differently.

Class AccessibleObject, boolean isAccessible()

Get the value of the accessible flag for this object. @return the value of the object's accessible flag

Class Array, Object newInstance(Class, int)

Creates a new array with the specified component type and length. Invoking this method is equivalent to creating an array as follows:
 int[] x = {length}; Array.newInstance(componentType x); 
@param componentType the Class object representing the component type of the new array @param length the length of the new array @return the new array @exception NullPointerException if the specified componentType parameter is null @exception IllegalArgumentException if componentType is Void.TYPE @exception NegativeArraySizeException if the specified length is negative
Class Array, Object newInstance(Class, int[])

Creates a new array with the specified component type and dimensions. If componentType represents a non-array class or interface the new array has dimensions.length dimensions and  componentType  as its component type. If componentType represents an array class the number of dimensions of the new array is equal to the sum of dimensions.length and the number of dimensions of componentType. In this case the component type of the new array is the component type of componentType.

The number of dimensions of the new array must not exceed the number of array dimensions supported by the implementation (typically 255). @param componentType the Class object representing the component type of the new array @param dimensions an array of int types representing the dimensions of the new array @return the new array @exception NullPointerException if the specified componentType argument is null @exception IllegalArgumentException if the specified dimensions argument is a zero-dimensional array or if the number of requested dimensions exceeds the limit on the number of array dimensions supported by the implementation (typically 255) or if componentType is Void.TYPE. @exception NegativeArraySizeException if any of the components in the specified dimensions argument is negative.

Class Array, void setBoolean(Object, int, boolean)

Sets the value of the indexed component of the specified array object to the specified boolean value. @param array the array @param index the index into the array @param valuez the new value of the indexed component @exception NullPointerException If the specified object argument is null @exception IllegalArgumentException If the specified object argument is not an array or if the the specified value cannot be converted to the underlying array's component type by an identity or a primitive widening widening conversion @exception ArrayIndexOutOfBoundsException If the specified index argument is negative or if it is greater than or equal to the length of the specified array @see Array#set
Class Array, void setByte(Object, int, byte)

Sets the value of the indexed component of the specified array object to the specified booleanbyte value. @param array the array @param index the index into the array @param valueb the new value of the indexed component @exception NullPointerException If the specified object argument is null @exception IllegalArgumentException If the specified object argument is not an array or if the the specified value cannot be converted to the underlying array's component type by an identity or a primitive widening widening conversion @exception ArrayIndexOutOfBoundsException If the specified index argument is negative or if it is greater than or equal to the length of the specified array @see Array#set
Class Array, void setChar(Object, int, char)

Sets the value of the indexed component of the specified array object to the specified bytechar value. @param array the array @param index the index into the array @param valuec the new value of the indexed component @exception NullPointerException If the specified object argument is null @exception IllegalArgumentException If the specified object argument is not an array or if the the specified value cannot be converted to the underlying array's component type by an identity or a primitive widening widening conversion @exception ArrayIndexOutOfBoundsException If the specified index argument is negative or if it is greater than or equal to the length of the specified array @see Array#set
Class Array, void setDouble(Object, int, double)

Sets the value of the indexed component of the specified array object to the specified double value. @param array the array @param index the index into the array @param valued the new value of the indexed component @exception NullPointerException If the specified object argument is null @exception IllegalArgumentException If the specified object argument is not an array or if the the specified value cannot be converted to the underlying array's component type by an identity or a primitive widening widening conversion @exception ArrayIndexOutOfBoundsException If the specified index argument is negative or if it is greater than or equal to the length of the specified array @see Array#set
Class Array, void setFloat(Object, int, float)

Sets the value of the indexed component of the specified array object to the specified float value. @param array the array @param index the index into the array @param valuef the new value of the indexed component @exception NullPointerException If the specified object argument is null @exception IllegalArgumentException If the specified object argument is not an array or if the the specified value cannot be converted to the underlying array's component type by an identity or a primitive widening widening conversion @exception ArrayIndexOutOfBoundsException If the specified index argument is negative or if it is greater than or equal to the length of the specified array @see Array#set
Class Array, void setInt(Object, int, int)

Sets the value of the indexed component of the specified array object to the specified int value. @param array the array @param index the index into the array @param valuei the new value of the indexed component @exception NullPointerException If the specified object argument is null @exception IllegalArgumentException If the specified object argument is not an array or if the the specified value cannot be converted to the underlying array's component type by an identity or a primitive widening widening conversion @exception ArrayIndexOutOfBoundsException If the specified index argument is negative or if it is greater than or equal to the length of the specified array @see Array#set
Class Array, void setLong(Object, int, long)

Sets the value of the indexed component of the specified array object to the specified long value. @param array the array @param index the index into the array @param valuel the new value of the indexed component @exception NullPointerException If the specified object argument is null @exception IllegalArgumentException If the specified object argument is not an array or if the the specified value cannot be converted to the underlying array's component type by an identity or a primitive widening widening conversion @exception ArrayIndexOutOfBoundsException If the specified index argument is negative or if it is greater than or equal to the length of the specified array @see Array#set
Class Array, void setShort(Object, int, short)

Sets the value of the indexed component of the specified array object to the specified short value. @param array the array @param index the index into the array @param values the new value of the indexed component @exception NullPointerException If the specified object argument is null @exception IllegalArgumentException If the specified object argument is not an array or if the the specified value cannot be converted to the underlying array's component type by an identity or a primitive widening widening conversion @exception ArrayIndexOutOfBoundsException If the specified index argument is negative or if it is greater than or equal to the length of the specified array @see Array#set

Class Constructor

Constructor provides information about and access to a single constructor for a class.

Constructor permits widening conversions to occur when matching the actual parameters to newInstance() with the underlying constructor's formal parameters but throws an IllegalArgumentException if a narrowing conversion would occur. @see Member @see java.lang.Class @see java.lang.Class#getConstructors() @see java.lang.Class#getConstructor(Class[]) @see java.lang.Class#getDeclaredConstructors() @author Kenneth Russell @author Nakul Saraiya

Class Constructor, Class[] getExceptionTypes()

Returns an array of Class objects that represent the types of of exceptions declared to be thrown by the underlying constructor represented by this Constructor object. Returns an array of length 0 if the constructor declares no exceptions in its throws clause. @return the exception types declared as being thrown by the constructor this object represents
Class Constructor, Class[] getParameterTypes()

Returns an array of Class objects that represent the formal parameter types in declaration order of the constructor represented by this Constructor object. Returns an array of length 0 if the underlying constructor takes no parameters. @return the parameter types for the constructor this object represents
Class Constructor, Object newInstance(Object[])

Uses the constructor represented by this Constructor object to create and initialize a new instance of the constructor's declaring class with the specified initialization parameters. Individual parameters are automatically unwrapped to match primitive formal parameters and both primitive and reference parameters are subject to method invocation conversions as necessary. Returns the newly created and initialized object. Creation proceeds with the following steps in order: If the class that declares the underlying constructor represents an abstract class the creation throws an InstantiationException. If this Constructor object enforces Java language access control and the underlying constructor is inaccessible the creation throws an IllegalAccessException.

If the number of actual parameters supplied via initargs is different from the number of formal parameters required by the underlying constructor the creation throws an IllegalArgumentException. A new instance of the constructor's declaring class is created and its fields are initialized to their default initial values. For each actual parameter in0 the supplied initargs array: If the corresponding formal parameter has a primitive type an unwrapping conversion is attempted to convert the object value to amay valuebe of the primitive type. If this attempt fails thelength creation0 throws anor IllegalArgumentExceptionnull.

If after possible unwrapping the parameter value cannot be converted to the corresponding formal parameterrequired type by a method invocation conversionaccess and argument checks succeed and the creation throws aninstantiation IllegalArgumentException.will Theproceed the constructor's declaring class is initialized if it has not already been initialized. A new instance of

If the constructor's declaring classcompletes normally isreturns the newly created and itsinitialized fieldsinstance. are@param initialized to their default initialinitargs array of objects to values.be Controlpassed as transfersarguments to the underlying constructor tocall; initialize the newvalues of primitive instance.types If the constructor completes abruptly by throwing an exception theare wrapped in a wrapper object of the appropriate type exception(e.g. isa placedfloat in ana InvocationTargetExceptionFloat and@return thrown in turn to the caller ofa new object created by calling the newInstance.constructor Ifthis the constructorobject represents completes@exception normally returns theIllegalAccessException if this newlyConstructor created and initializedobject enforces Java instance.language @exceptionaccess IllegalAccessException ifcontrol and the underlying constructor is inaccessible. @exception IllegalArgumentException if the number of actual and formal parameters differ or; if an unwrapping conversion for primitive arguments fails; or if after possible unwrapping a parameter value cannot be converted to the corresponding formal parameter type by a method invocation conversion fails. @exception InstantiationException if the class that declares the underlying constructor represents an abstract class. @exception InvocationTargetException if the underlying constructor throws an exception. @exception ExceptionInInitializerError if the initialization provoked by this method fails.


Class Field

A Field provides information about and dynamic access to a single field of a class or an interface. The reflected field may be a class (static) field or an instance field.

A Field permits widening conversions to occur during a get or set access operation but throws an IllegalArgumentException if a narrowing conversion would occur. @see Member @see java.lang.Class @see java.lang.Class#getFields() @see java.lang.Class#getField(String) @see java.lang.Class#getDeclaredFields() @see java.lang.Class#getDeclaredField(String) @author Kenneth Russell @author Nakul Saraiya

Class Field, Object get(Object)

Returns the value of the field represented by this Field on the specified object. The value is automatically wrapped in an object if it has a primitive type.

The underlying field's value is obtained as follows:

If the underlying field is a static field the obj argument is ignored; it may be null.

Otherwise the underlying field is an instance field. If the specified obj argument is null the method throws a NullPointerException. If the specified object is not an instance of the class or interface declaring the underlying field the method throws an IllegalArgumentException.

If this Field object enforces Java language access control and the underlying field is inaccessible the method throws an IllegalAccessException. If the underlying field is static the class that declared the field is initialized if it has not already been initialized.

Otherwise the value is retrieved from the underlying instance or static field. If the field has a primitive type the value is wrapped in an object before being returned otherwise it is returned as is.

If the field is hidden in the type of obj the field's value is obtained according to the preceding rules. @param obj object from which the represented field's value is to be extracted @return the value of the represented field in object obj; primitive values are wrapped in an appropriate object before being returned @exception IllegalAccessException if the underlying constructorfield is inaccessible. @exception IllegalArgumentException if the specified object is not an instance of the class or interface declaring the underlying field (or a subclass or implementor thereof). @exception NullPointerException if the specified object is null and the field is an instance field. @exception ExceptionInInitializerError if the initialization provoked by this method fails.

Class Field, boolean getBoolean(Object)

Gets the value of a field as astatic or instance boolean on the specified objectfield. This@param method is equivalentobj the object to ((Boolean)get(obj)).booleanValue() exceptextract that anthe IllegalArgumentExceptionboolean isvalue thrownfrom if@return the field value cannot be converted toof the type boolean by a widening conversion.field @exception IllegalAccessException if the underlying constructorfield is inaccessible. @exception IllegalArgumentException if the specified object is not an instance of the class or interface declaring the underlying field (or a subclass or implementor thereof) or if the field value cannot be converted to the type boolean by a widening conversion. @exception NullPointerException if the specified object is null and the field is an instance field. @exception ExceptionInInitializerError if the initialization provoked by this method fails. @see Field#get
Class Field, byte getByte(Object)

Gets the value of a field as astatic or instance byte on the specified objectfield. This@param method is equivalentobj the object to ((Number)get(obj)).byteValue() exceptextract that anthe IllegalArgumentExceptionbyte isvalue thrownfrom if@return the field value cannot be converted toof the type byte by a widening conversion.field @exception IllegalAccessException if the underlying constructorfield is inaccessible. @exception IllegalArgumentException if the specified object is not an instance of the class or interface declaring the underlying field (or a subclass or implementor thereof) or if the field value cannot be converted to the type byte by a widening conversion. @exception NullPointerException if the specified object is null and the field is an instance field. @exception ExceptionInInitializerError if the initialization provoked by this method fails. @see Field#get
Class Field, char getChar(Object)

Gets the value of a static or instance field as aof type char on the specifiedor object.of This method is equivalentanother primitive type convertible to type ((Character)get(obj)).charValue()char except thatvia a anwidening conversion. @param obj the object to extract the IllegalArgumentExceptionchar isvalue thrownfrom if@return the field value cannot beof the field converted to the type char by a widening conversion. @exception IllegalAccessException if the underlying constructorfield is inaccessible. @exception IllegalArgumentException if the specified object is not an instance of the class or interface declaring the underlying field (or a subclass or implementor thereof) or if the field value cannot be converted to the type char by a widening conversion. @exception NullPointerException if the specified object is null and the field is an instance field. @exception ExceptionInInitializerError if the initialization provoked by this method fails. @see Field#get
Class Field, double getDouble(Object)

Gets the value of a static or instance field as aof type double on the specifiedor object.of This method is equivalentanother primitive type convertible to type ((Number)get(obj)).doubleValue()double except thatvia a anwidening conversion. @param obj the object to extract the IllegalArgumentExceptiondouble isvalue thrownfrom if@return the field value cannot beof the field converted to the type double by a widening conversion. @exception IllegalAccessException if the underlying constructorfield is inaccessible. @exception IllegalArgumentException if the specified object is not an instance of the class or interface declaring the underlying field (or a subclass or implementor thereof) or if the field value cannot be converted to the type double by a widening conversion. @exception NullPointerException if the specified object is null and the field is an instance field. @exception ExceptionInInitializerError if the initialization provoked by this method fails. @see Field#get
Class Field, float getFloat(Object)

Gets the value of a static or instance field as aof type float on the specifiedor object.of This method is equivalentanother primitive type convertible to type ((Number)get(obj)).floatValue()float except thatvia a anwidening conversion. @param obj the object to extract the IllegalArgumentExceptionfloat isvalue thrownfrom if@return the field value cannot beof the field converted to the type float by a widening conversion. @exception IllegalAccessException if the underlying constructorfield is inaccessible. @exception IllegalArgumentException if the specified object is not an instance of the class or interface declaring the underlying field (or a subclass or implementor thereof) or if the field value cannot be converted to the type float by a widening conversion. @exception NullPointerException if the specified object is null and the field is an instance field. @exception ExceptionInInitializerError if the initialization provoked by this method fails. @see Field#get
Class Field, int getInt(Object)

Gets the value of a static or instance field as anof type int on the specifiedor object.of This method is equivalentanother primitive type convertible to type ((Number)get(obj)).intValue()int except thatvia a anwidening conversion. @param obj the object to extract the IllegalArgumentExceptionint isvalue thrownfrom if@return the field value cannot beof the field converted to the type int by a widening conversion. @exception IllegalAccessException if the underlying constructorfield is inaccessible. @exception IllegalArgumentException if the specified object is not an instance of the class or interface declaring the underlying field (or a subclass or implementor thereof) or if the field value cannot be converted to the type int by a widening conversion. @exception NullPointerException if the specified object is null and the field is an instance field. @exception ExceptionInInitializerError if the initialization provoked by this method fails. @see Field#get
Class Field, long getLong(Object)

Gets the value of a static or instance field as aof type long on the specifiedor object.of This method is equivalentanother primitive type convertible to type ((Number)get(obj)).longValue()long except thatvia a anwidening conversion. @param obj the object to extract the IllegalArgumentExceptionlong isvalue thrownfrom if@return the field value cannot beof the field converted to the type long by a widening conversion. @exception IllegalAccessException if the underlying constructorfield is inaccessible. @exception IllegalArgumentException if the specified object is not an instance of the class or interface declaring the underlying field (or a subclass or implementor thereof) or if the field value cannot be converted to the type long by a widening conversion. @exception NullPointerException if the specified object is null and the field is an instance field. @exception ExceptionInInitializerError if the initialization provoked by this method fails. @see Field#get
Class Field, short getShort(Object)

Gets the value of a static or instance field as aof type short on the specifiedor object.of This method is equivalentanother primitive type convertible to type ((Number)get(obj)).shortValue()short except thatvia a anwidening conversion. @param obj the object to extract the IllegalArgumentExceptionshort isvalue thrownfrom if@return the field value cannot beof the field converted to the type short by a widening conversion. @exception IllegalAccessException if the underlying constructorfield is inaccessible. @exception IllegalArgumentException if the specified object is not an instance of the class or interface declaring the underlying field (or a subclass or implementor thereof) or if the field value cannot be converted to the type short by a widening conversion. @exception NullPointerException if the specified object is null and the field is an instance field. @exception ExceptionInInitializerError if the initialization provoked by this method fails. @see Field#get
Class Field, Class getType()

Returns a Class object that identifies the declared type for the field represented by this Field object. @return a Class object identifying the declared type of the field represented by this object
Class Field, void set(Object, Object)

Sets the field represented by this Field object on the specified object argument to the specified new value. The new value is automatically unwrapped if the underlying field has a primitive type.

The operation proceeds as follows:

If the underlying field is static the obj argument is ignored; it may be null.

Otherwise the underlying field is an instance field. If the specified object argument is null the method throws a NullPointerException. If the specified object argument is not an instance of the class or interface declaring the underlying field the method throws an IllegalArgumentException.

If this Field object enforces Java language access control and the underlying field is inaccessible the method throws an IllegalAccessException.

If the underlying field is final the method throws an IllegalAccessException.

If the underlying field is of a primitive type an unwrapping conversion is attempted to convert the new value to a value of a primitive type. If this attempt fails the method throws an IllegalArgumentException.

If after possible unwrapping the new value cannot be converted to the type of the underlying field by an identity or widening conversion the method throws an IllegalArgumentException.

If the underlying field is static the class that declared the field is initialized if it has not already been initialized.

The field is set to the possibly unwrapped and widened new value.

If the field is hidden in the type of obj the field's value is set according to the preceding rules. @param obj the object whose field should be modified @param value the new value for the field of obj being modified @exception IllegalAccessException if the underlying constructorfield is inaccessible. @exception IllegalArgumentException if the specified object is not an instance of the class or interface declaring the underlying field (or a subclass or implementor thereof) or if an unwrapping conversion fails. @exception NullPointerException if the specified object is null and the field is an instance field. @exception ExceptionInInitializerError if the initialization provoked by this method fails.

Class Field, void setBoolean(Object, boolean)

Sets the value of a field as a boolean on the specified object. This method is equivalent to set(obj zObj) where zObj is a Boolean object and zObj.booleanValue() == z. @param obj the object whose field should be modified @param z the new value for the field of obj being modified @exception IllegalAccessException if the underlying constructorfield is inaccessible. @exception IllegalArgumentException if the specified object is not an instance of the class or interface declaring the underlying field (or a subclass or implementor thereof) or if an unwrapping conversion fails. @exception NullPointerException if the specified object is null and the field is an instance field. @exception ExceptionInInitializerError if the initialization provoked by this method fails. @see Field#set
Class Field, void setByte(Object, byte)

Sets the value of a field as a byte on the specified object. This method is equivalent to set(obj bObj) where bObj is a Byte object and bObj.byteValue() == b. @param obj the object whose field should be modified @param b the new value for the field of obj being modified @exception IllegalAccessException if the underlying constructorfield is inaccessible. @exception IllegalArgumentException if the specified object is not an instance of the class or interface declaring the underlying field (or a subclass or implementor thereof) or if an unwrapping conversion fails. @exception NullPointerException if the specified object is null and the field is an instance field. @exception ExceptionInInitializerError if the initialization provoked by this method fails. @see Field#set
Class Field, void setChar(Object, char)

Sets the value of a field as a char on the specified object. This method is equivalent to set(obj cObj) where cObj is a Character object and cObj.charValue() == c. @param obj the object whose field should be modified @param c the new value for the field of obj being modified @exception IllegalAccessException if the underlying constructorfield is inaccessible. @exception IllegalArgumentException if the specified object is not an instance of the class or interface declaring the underlying field (or a subclass or implementor thereof) or if an unwrapping conversion fails. @exception NullPointerException if the specified object is null and the field is an instance field. @exception ExceptionInInitializerError if the initialization provoked by this method fails. @see Field#set
Class Field, void setDouble(Object, double)

Sets the value of a field as a double on the specified object. This method is equivalent to set(obj dObj) where dObj is a Double object and dObj.doubleValue() == d. @param obj the object whose field should be modified @param d the new value for the field of obj being modified @exception IllegalAccessException if the underlying constructorfield is inaccessible. @exception IllegalArgumentException if the specified object is not an instance of the class or interface declaring the underlying field (or a subclass or implementor thereof) or if an unwrapping conversion fails. @exception NullPointerException if the specified object is null and the field is an instance field. @exception ExceptionInInitializerError if the initialization provoked by this method fails. @see Field#set
Class Field, void setFloat(Object, float)

Sets the value of a field as a float on the specified object. This method is equivalent to set(obj fObj) where fObj is a Float object and fObj.floatValue() == f. @param obj the object whose field should be modified @param f the new value for the field of obj being modified @exception IllegalAccessException if the underlying constructorfield is inaccessible. @exception IllegalArgumentException if the specified object is not an instance of the class or interface declaring the underlying field (or a subclass or implementor thereof) or if an unwrapping conversion fails. @exception NullPointerException if the specified object is null and the field is an instance field. @exception ExceptionInInitializerError if the initialization provoked by this method fails. @see Field#set
Class Field, void setInt(Object, int)

Sets the value of a field as an int on the specified object. This method is equivalent to set(obj iObj) where iObj is a Integer object and iObj.intValue() == i. @param obj the object whose field should be modified @param i the new value for the field of obj being modified @exception IllegalAccessException if the underlying constructorfield is inaccessible. @exception IllegalArgumentException if the specified object is not an instance of the class or interface declaring the underlying field (or a subclass or implementor thereof) or if an unwrapping conversion fails. @exception NullPointerException if the specified object is null and the field is an instance field. @exception ExceptionInInitializerError if the initialization provoked by this method fails. @see Field#set
Class Field, void setLong(Object, long)

Sets the value of a field as a long on the specified object. This method is equivalent to set(obj lObj) where lObj is a Long object and lObj.longValue() == l. @param obj the object whose field should be modified @param l the new value for the field of obj being modified @exception IllegalAccessException if the underlying constructorfield is inaccessible. @exception IllegalArgumentException if the specified object is not an instance of the class or interface declaring the underlying field (or a subclass or implementor thereof) or if an unwrapping conversion fails. @exception NullPointerException if the specified object is null and the field is an instance field. @exception ExceptionInInitializerError if the initialization provoked by this method fails. @see Field#set
Class Field, void setShort(Object, short)

Sets the value of a field as a short on the specified object. This method is equivalent to set(obj sObj) where sObj is a Short object and sObj.shortValue() == s. @param obj the object whose field should be modified @param s the new value for the field of obj being modified @exception IllegalAccessException if the underlying constructorfield is inaccessible. @exception IllegalArgumentException if the specified object is not an instance of the class or interface declaring the underlying field (or a subclass or implementor thereof) or if an unwrapping conversion fails. @exception NullPointerException if the specified object is null and the field is an instance field. @exception ExceptionInInitializerError if the initialization provoked by this method fails. @see Field#set

Class InvocationHandler

InvocationHandler is the interface implemented by the invocation handler of a proxy instance.

Each proxy instance has an associated invocation handler. When a method is invoked on a proxy instance the method invocation is encoded and dispatched to the invoke method of its invocation handler. @author Peter Jones @version 1.5 006 01/0212/0203 @see Proxy @since JDK1.3


Class InvocationTargetException

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. The "target exception" that is provided at construction time and accessed via the #getTargetException() method is now known as the cause and may be accessed via the Throwable#getCause() method as well as the aforementioned "legacy method." @see Method @see Constructor

Class InvocationTargetException, constructor InvocationTargetException(Throwable)

Constructs a InvocationTargetException with a target exception. @param target the target exception
Class InvocationTargetException, constructor InvocationTargetException(Throwable, String)

Constructs a InvocationTargetException with a target exception and a detail message. @param target the target exception @param s the detail message
Class InvocationTargetException, Throwable getTargetException()

Get the thrown target exception.

This method predates the general-purpose exception chaining facility. The Throwable#getCause() method is now the preferred means of obtaining this information. @return the thrown target exception (cause of this exception).


Class Member, Class getDeclaringClass()

Returns the Class object representing the class or interface that declares the member or constructor represented by this Member. @return an object representing the declaring class of the underlying member
Class Member, int getModifiers()

Returns the Java language modifiers for the member or constructor represented by this Member as an integer. The Modifier class should be used to decode the modifiers in the integer. @return the Java language modifiers for the underlying member @see Modifier
Class Member, String getName()

Returns the simple name of the underlying member or constructor represented by this Member. @return the simple name of the underlying member

Class Method

A Method provides information about and access to a single method on a class or interface. The reflected method may be a class method or an instance method (including an abstract method).

A Method permits widening conversions to occur when matching the actual parameters to invokewith the underlying method's formal parameters but it throws an IllegalArgumentException if a narrowing conversion would occur. @see Member @see java.lang.Class @see java.lang.Class#getMethods() @see java.lang.Class#getMethod(String Class[]) @see java.lang.Class#getDeclaredMethods() @see java.lang.Class#getDeclaredMethod(String Class[]) @author Kenneth Russell @author Nakul Saraiya

Class Method, Class[] getExceptionTypes()

Returns an array of Class objects that represent the types of the exceptions declared to be thrown by the underlying method represented by this Method object. Returns an array of length 0 if the method declares no exceptions in its throws clause. @return the exception types declared as being thrown by the method this object represents
Class Method, Class[] getParameterTypes()

Returns an array of Class objects that represent the formal parameter types in declaration order of the method represented by this Method object. Returns an array of length 0 if the underlying method takes no parameters. @return the parameter types for the method this object represents
Class Method, Class getReturnType()

Returns a Class object that represents the formal return type of the method represented by this Method object. @return the return type for the method this object represents
Class Method, Object invoke(Object, Object[])

Invokes the underlying method represented by this Method object on the specified object with the specified parameters. Individual parameters are automatically unwrapped to match primitive formal parameters and both primitive and reference parameters are subject to wideningmethod invocation conversions as necessary. The value returned by the underlying method is automatically wrapped in an object if it has a primitive type.

Method invocation proceeds with the following steps in order: If the underlying method is static then the specified obj argument is ignored. It may be null.

Otherwise the method is an instance method. If the specified object argument is null the invocation throws a NullPointerException. Otherwise if the specified object argument is not an instance of the class or interface declaring the underlying method (or of a subclass or implementor thereof) the invocation throws an IllegalArgumentException. If this Method object enforces Java language access control and the underlying method is inaccessible the invocation throws an IllegalAccessException. If the number of actual parameters supplied via args is different from the number of formal parameters required by the underlying method the invocation throws an IllegalArgumentException. For each actual parameteris in0 the supplied args array: If the corresponding formal parameter has a primitive type an unwrapping conversion is attempted to convert the object value to a value of a primitive type. If this attempt fails the invocation throws an IllegalArgumentException. If after possible unwrapping the parameter value cannotmay be converted to the corresponding formal parameter type by a method invocation conversion theof invocation throws anlength 0 or IllegalArgumentExceptionnull.

If the underlying method is an instance method it is invoked using dynamic method lookup as documented in The Java Language Specification Second Edition section 15.1112.4.4; in particular overriding based on the runtime type of the target object will occur.

If the underlying method is static the class that declared the method is initialized if it has not already been initialized. The underlying method is invoked directly. Control transfers to the invoked method. If the method completes abruptly by throwing an exception the exception is placed in an InvocationTargetException and thrown in turn to the caller of invoke.

If the method completes normally the value it returns is returned to the caller of invoke; if the value has a primitive type it is first appropriately wrapped in an object. If the underlying method return type is void the invocation returns null. @param obj the object the underlying method is invoked from @param args the arguments used for the method call @return the result of dispatching the method represented by this object on obj with parameters args @exception IllegalAccessException if this Method object enforces Java language access control and the underlying method is inaccessible. @exception IllegalArgumentException if the method is an instance method and the specified object argument is not an instance of the class or interface declaring the underlying method (or of a subclass or implementor thereof); if the number of actual and formal parameters differ or; if an unwrapping conversion for primitive arguments fails; or if after possible unwrapping a parameter value cannot be converted to the corresponding formal parameter type by a method invocation conversion. @exception InvocationTargetException if the underlying method throws an exception. @exception NullPointerException if the specified object is null and the method is an instance method. @exception ExceptionInInitializerError if the initialization provoked by this method fails.


Class Modifier

The Modifier class provides static methods and constants to decode class and member access modifiers. The sets of modifiers are represented as integers with distinct bit positions representing different modifiers. The values for the constants representing the modifiers are taken from The JavaTM Virtual Machine Specification Second edition tables 4.1 4.4 4.5 and 4.7. @see Class#getModifiers() @see Member#getModifiers() @author Nakul Saraiya @author Kenneth Russell
Class Modifier, boolean isAbstract(int)

Return true if the specifier integer argument includes the abstract modifer false otherwise. @param mod a set of modifers @return true if mod includes the abstract modifier; false otherwise.
Class Modifier, boolean isFinal(int)

Return true if the specified integer argument includes the final modifer false otherwise. @param mod a set of modifers @return true if mod includes the final modifier; false otherwise.
Class Modifier, boolean isInterface(int)

Return true if the specifier integer argument includes the interface modifer false otherwise. @param mod a set of modifers @return true if mod includes the interface modifier; false otherwise.
Class Modifier, boolean isNative(int)

Return true if the specifier integer argument includes the native modifer false otherwise. @param mod a set of modifers @return true if mod includes the native modifier; false otherwise.
Class Modifier, boolean isPrivate(int)

Return true if the specifier integer argument includes the private modifer false otherwise. @param mod a set of modifers @return true if mod includes the private modifier; false otherwise.
Class Modifier, boolean isProtected(int)

Return true if the specifier integer argument includes the protected modifer false otherwise. @param mod a set of modifers @return true if mod includes the protected modifier; false otherwise.
Class Modifier, boolean isPublic(int)

Return true if the specified integer argument includes the public modifer false otherwise. @param mod a set of modifers @return true if mod includes the public modifier; false otherwise.
Class Modifier, boolean isStatic(int)

Return true if the specifier integer argument includes the static modifer false otherwise. @param mod a set of modifers @return true if mod includes the static modifier; false otherwise.
Class Modifier, boolean isStrict(int)

Return true if the specifier integer argument includes the strictfp modifer false otherwise. @param mod a set of modifers @return true if mod includes the strictfp modifier; false otherwise.
Class Modifier, boolean isSynchronized(int)

Return true if the specified integer argument includes the synchronized modifer false otherwise. @param mod a set of modifers @return true if mod includes the synchronized modifier; false otherwise.
Class Modifier, boolean isTransient(int)

Return true if the specifier integer argument includes the transient modifer false otherwise. @param mod a set of modifers @return true if mod includes the transient modifier; false otherwise.
Class Modifier, boolean isVolatile(int)

Return true if the specified integer argument includes the volatile modifer false otherwise. @param mod a set of modifers @return true if mod includes the volatile modifier; false otherwise.
Class Modifier, String toString(int)

Return a string describing the access modifier flags in the specified modifier. For example:
 public final synchronized private transientstrictfp volatile 
The modifier names are returnreturned in canonicalan order as specifiedconsistent with bythe suggested modifier orderings given in The Java Language Specification Second Edition sections §8.1.1 §8.3.1 §8.4.3 §8.8.3 and §9.1.1. The full modifier ordering used by this method is:
public protected private abstract static final transient volatile synchronized native strictfp interface
The interface modifier discussed in this class is not a true modifier in the Java language and it appears after all other modifiers listed by this method. This method may return a string of modifiers that are not valid modifiers of a Java entity; in other words no checking is done on the possible validity of the combination of modifiers represented by the input
. @param mod a set of modifers @return a string representation of the set of modifers represented by mod

Class Proxy

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 invoke 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. The invocation handler processes the encoded method invocation as appropriate and the result that it returns will be returned as the result of the method invocation on the proxy instance.

A proxy class has the following properties:

A proxy instance has the following properties:

Methods Duplicated in Multiple Proxy Interfaces

When two or more interfaces of a proxy class contain a method with the same name and parameter signature the order of the proxy class's interfaces becomes significant. When such a duplicate method is invoked on a proxy instance the Method object passed to the invocation handler will not necessarily be the one whose declaring class is assignable from the reference type of the interface that the proxy's method was invoked through. This limitation exists because the corresponding method implementation in the generated proxy class cannot determine which interface it was invoked through. Therefore when a duplicate method is invoked on a proxy instance the Method object for the method in the foremost interface that contains the method (either directly or inherited through a superinterface) in the proxy class's list of interfaces is passed to the invocation handler's invoke method regardless of the reference type through which the method invocation occurred.

If a proxy interface contains a method with the same name and parameter signature as the hashCode equals or toString methods of java.lang.Object when such a method is invoked on a proxy instance the Method object passed to the invocation handler will have java.lang.Object as its declaring class. In other words the public non-final methods of java.lang.Object logically precede all of the proxy interfaces for the determination of which Method object to pass to the invocation handler.

Note also that when a duplicate method is dispatched to an invocation handler the invoke method may only throw checked exception types that are assignable to one of the exception types in the throws clause of the method in all of the proxy interfaces that it can be invoked through. If the invoke method throws a checked exception that is not assignable to any of the exception types declared by the method in one of the the proxy interfaces that it can be invoked through then an unchecked UndeclaredThrowableException will be thrown by the invocation on the proxy instance. This restriction means that not all of the exception types returned by invoking getExceptionTypes on the Method object passed to the invoke method can necessarily be thrown successfully by the invoke method. @author Peter Jones @version 1.8 009 01/0212/0203 @see InvocationHandler @since JDK1.3


Class UndeclaredThrowableException

Thrown by a method invocation on a proxy instance if its invocation handler's 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. The "undeclared checked exception that was thrown by the invocation handler" that may be provided at construction time and accessed via the #getUndeclaredThrowable() method is now known as the cause and may be accessed via the Throwable#getCause() method as well as the aforementioned "legacy method." @author Peter Jones @version 1.6 0010 01/0212/0203 @see InvocationHandler @since JDK1.3

Class UndeclaredThrowableException, constructor UndeclaredThrowableException(Throwable)

Constructs an UndeclaredThrowableException with the specifedspecified Throwable. @param undeclaredThrowable the undeclared checked exception that was thrown
Class UndeclaredThrowableException, Throwable getUndeclaredThrowable()

Returns the Throwable instance wrapped in this UndeclaredThrowableException which may be null.

This method predates the general-purpose exception chaining facility. The Throwable#getCause() method is now the preferred means of obtaining this information. @return the undeclared checked exception that was thrown