| java.lang.Object sun.reflect.ReflectionFactory
ReflectionFactory | public class ReflectionFactory (Code) | | The master factory for all reflective objects, both those in
java.lang.reflect (Fields, Methods, Constructors) as well as their
delegates (FieldAccessors, MethodAccessors, ConstructorAccessors).
The methods in this class are extremely unsafe and can cause
subversion of both the language and the verifier. For this reason,
they are all instance methods, and access to the constructor of
this factory is guarded by a security check, in similar style to
sun.misc.Unsafe .
|
Inner Class :final public static class GetReflectionFactoryAction implements PrivilegedAction | |
Method Summary | |
public Constructor | copyConstructor(Constructor arg) Makes a copy of the passed constructor. | public Field | copyField(Field arg) Makes a copy of the passed field. | public Method | copyMethod(Method arg) Makes a copy of the passed method. | public ConstructorAccessor | getConstructorAccessor(Constructor c) | public MethodAccessor | getMethodAccessor(Method m) | public static ReflectionFactory | getReflectionFactory() Provides the caller with the capability to instantiate reflective
objects.
First, if there is a security manager, its
checkPermission method is called with a
java.lang.RuntimePermission with target
"reflectionFactoryAccess" . | static int | inflationThreshold() | public Constructor | newConstructor(Class declaringClass, Class[] parameterTypes, Class[] checkedExceptions, int modifiers, int slot, String signature, byte[] annotations, byte[] parameterAnnotations) Creates a new java.lang.reflect.Constructor. | public ConstructorAccessor | newConstructorAccessor(Constructor c) | public Constructor | newConstructorForSerialization(Class classToInstantiate, Constructor constructorToCall) | public Field | newField(Class declaringClass, String name, Class type, int modifiers, int slot, String signature, byte[] annotations) Creates a new java.lang.reflect.Field. | public FieldAccessor | newFieldAccessor(Field field, boolean override) Note: this routine can cause the declaring class for the field
be initialized and therefore must not be called until the
first get/set of this field. | public Method | newMethod(Class declaringClass, String name, Class[] parameterTypes, Class returnType, Class[] checkedExceptions, int modifiers, int slot, String signature, byte[] annotations, byte[] parameterAnnotations, byte[] annotationDefault) Creates a new java.lang.reflect.Method. | public MethodAccessor | newMethodAccessor(Method method) | public void | setConstructorAccessor(Constructor c, ConstructorAccessor accessor) | public void | setLangReflectAccess(LangReflectAccess access) | public void | setMethodAccessor(Method m, MethodAccessor accessor) |
copyConstructor | public Constructor copyConstructor(Constructor arg)(Code) | | Makes a copy of the passed constructor. The returned
constructor is a "child" of the passed one; see the comments
in Constructor.java for details.
|
copyField | public Field copyField(Field arg)(Code) | | Makes a copy of the passed field. The returned field is a
"child" of the passed one; see the comments in Field.java for
details.
|
copyMethod | public Method copyMethod(Method arg)(Code) | | Makes a copy of the passed method. The returned method is a
"child" of the passed one; see the comments in Method.java for
details.
|
getMethodAccessor | public MethodAccessor getMethodAccessor(Method m)(Code) | | Gets the MethodAccessor object for a java.lang.reflect.Method
|
getReflectionFactory | public static ReflectionFactory getReflectionFactory()(Code) | | Provides the caller with the capability to instantiate reflective
objects.
First, if there is a security manager, its
checkPermission method is called with a
java.lang.RuntimePermission with target
"reflectionFactoryAccess" . This may result in a
security exception.
The returned ReflectionFactory object should be
carefully guarded by the caller, since it can be used to read and
write private data and invoke private methods, as well as to load
unverified bytecodes. It must never be passed to untrusted code.
exception: SecurityException - if a security manager exists and itscheckPermission method doesn't allowaccess to the RuntimePermission "reflectionFactoryAccess". |
inflationThreshold | static int inflationThreshold()(Code) | | |
newConstructor | public Constructor newConstructor(Class declaringClass, Class[] parameterTypes, Class[] checkedExceptions, int modifiers, int slot, String signature, byte[] annotations, byte[] parameterAnnotations)(Code) | | Creates a new java.lang.reflect.Constructor. Access checks as
per java.lang.reflect.AccessibleObject are not overridden.
|
newField | public Field newField(Class declaringClass, String name, Class type, int modifiers, int slot, String signature, byte[] annotations)(Code) | | Creates a new java.lang.reflect.Field. Access checks as per
java.lang.reflect.AccessibleObject are not overridden.
|
newFieldAccessor | public FieldAccessor newFieldAccessor(Field field, boolean override)(Code) | | Note: this routine can cause the declaring class for the field
be initialized and therefore must not be called until the
first get/set of this field.
Parameters: field - the field Parameters: override - true if caller has overridden aaccessibility |
newMethod | public Method newMethod(Class declaringClass, String name, Class[] parameterTypes, Class returnType, Class[] checkedExceptions, int modifiers, int slot, String signature, byte[] annotations, byte[] parameterAnnotations, byte[] annotationDefault)(Code) | | Creates a new java.lang.reflect.Method. Access checks as per
java.lang.reflect.AccessibleObject are not overridden.
|
setLangReflectAccess | public void setLangReflectAccess(LangReflectAccess access)(Code) | | Called only by java.lang.reflect.Modifier's static initializer
|
setMethodAccessor | public void setMethodAccessor(Method m, MethodAccessor accessor)(Code) | | Sets the MethodAccessor object for a java.lang.reflect.Method
|
|
|