Save This Page
Home » openjdk-7 » java » lang » reflect » [javadoc | source]
java.lang.reflect
final class: VMReflection [javadoc | source]
java.lang.Object
   java.lang.reflect.VMReflection
Provides the package private methods requirered for the java.lang.reflect package implementation.

This class must be implemented according to the common policy for porting interfaces - see the porting interface overview for more detailes.

Note: this class design is based on requirements for the Field , Method and Constructor classes from the java.lang.reflect package. Each class (Field, Method, Constructor) should have a constructor that accepts an argument of the java.lang.Object type. This argument serves as an identifier of particular item. This identifier should be used later when one needs to operate with an item. For example, see VMReflection.getFieldType(Object id) method.

Method from java.lang.reflect.VMReflection Summary:
getExceptionTypes,   getFieldType,   getMethodReturnType,   getParameterTypes,   invokeMethod,   newArrayInstance,   newClassInstance
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from java.lang.reflect.VMReflection Detail:
 static native Class<?>[] getExceptionTypes(long id)
    This method satisfies the requirements of the specification for the Method.getExceptionTypes() method. But it takes one additional id parameter.
 static native Class<?> getFieldType(long id)
    This method satisfies the requirements of the specification for the Field.getType() method. But it takes one additional id parameter.
 static native Class<?> getMethodReturnType(long id)
    This method satisfies the requirements of the specification for the Method.getReturnType() method. But it takes one additional id parameter.
 static native Class<?>[] getParameterTypes(long id)
    This method satisfies the requirements of the specification for the Method.getParameterTypes() method. But it takes one additional id parameter.
 static native Object invokeMethod(long id,
    Object object,
    Object args) throws InvocationTargetException
    This method satisfies the requirements of the specification for the java.lang.Object[]) obj, Object[] args) method. But it differs in several ways.

    First, it takes one additional id parameter. This parameter is used as an identifier to invoke corresponding method.

    Second, it doesn't perform access control so it doesn't throw an IllegalAccessException exception.

    Third, it throws IllegalArgumentException only if the args argument doesn't fit to the actual method parameters.

    Last, it doesn't throw an NullPointerException exception. If the id argument corresponds to a static method then the object argument must be null. An attempt to invoke a static method will be made in this case. If the id argument corresponds to a non-static method then corresponding object's method will be invoked.

    Note: Under design yet. Subjected to change.

 static native Object newArrayInstance(Class<?> type,
    int[] dimensions)
    This method satisfies the requirements of the specification for the int[]) componentType, int[] dimensions) method. But it differs in several ways.

    First, it it doesn't throw an NullPointerException exception.

    Second, it throws an IllegalArgumentException exception only if the implementation doesn't support specified number of dimensions.

    Note: Under design yet. Subjected to change.

 static native Object newClassInstance(long id,
    Object args) throws InvocationTargetException
    This method satisfies the requirements of the specification for the Constructor.newInstance(java.lang.Object[] initargs) method. But it differs in several ways.

    First, it takes one additional id parameter. This parameter is used as an identifier of the corresponding constructor.

    Second, it doesn't perform access control so it doesn't throw an IllegalAccessException exception.

    Last, it doesn't throw an InstantiationException exception. The id argument must not correspond to an abstract class.

    Note: Under design yet. Subjected to change.