sun.reflect
Class Reflection
java.lang.Object
sun.reflect.Reflection
public class Reflection
- extends Object
Common utility routines used by both java.lang and
java.lang.reflect
Method Summary |
static void |
ensureMemberAccess(Class currentClass,
Class memberClass,
Object target,
int modifiers)
|
static Field[] |
filterFields(Class containingClass,
Field[] fields)
|
static Method[] |
filterMethods(Class containingClass,
Method[] methods)
|
static Class |
getCallerClass(int realFramesToSkip)
Returns the class of the method realFramesToSkip
frames up the stack (zero-based), ignoring frames associated
with java.lang.reflect.Method.invoke() and its implementation. |
static boolean |
quickCheckMemberAccess(Class memberClass,
int modifiers)
A quick "fast-path" check to try to avoid getCallerClass()
calls. |
static void |
registerFieldsToFilter(Class containingClass,
String... fieldNames)
|
static void |
registerMethodsToFilter(Class containingClass,
String... methodNames)
|
static boolean |
verifyMemberAccess(Class currentClass,
Class memberClass,
Object target,
int modifiers)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Reflection
public Reflection()
getCallerClass
public static Class getCallerClass(int realFramesToSkip)
- Returns the class of the method
realFramesToSkip
frames up the stack (zero-based), ignoring frames associated
with java.lang.reflect.Method.invoke() and its implementation.
The first frame is that associated with this method, so
getCallerClass(0)
returns the Class object for
sun.reflect.Reflection. Frames associated with
java.lang.reflect.Method.invoke() and its implementation are
completely ignored and do not count toward the number of "real"
frames skipped.
quickCheckMemberAccess
public static boolean quickCheckMemberAccess(Class memberClass,
int modifiers)
- A quick "fast-path" check to try to avoid getCallerClass()
calls.
ensureMemberAccess
public static void ensureMemberAccess(Class currentClass,
Class memberClass,
Object target,
int modifiers)
throws IllegalAccessException
- Throws:
IllegalAccessException
verifyMemberAccess
public static boolean verifyMemberAccess(Class currentClass,
Class memberClass,
Object target,
int modifiers)
registerFieldsToFilter
public static void registerFieldsToFilter(Class containingClass,
String... fieldNames)
registerMethodsToFilter
public static void registerMethodsToFilter(Class containingClass,
String... methodNames)
filterFields
public static Field[] filterFields(Class containingClass,
Field[] fields)
filterMethods
public static Method[] filterMethods(Class containingClass,
Method[] methods)