Only intended for internal use.
| Modifier and Type | Class and Description |
|---|---|
| public static interface | ReflectionUtils.FieldCallback
Callback interface invoked on each field in the hierarchy. |
| public static interface | ReflectionUtils.FieldFilter
Callback optionally used to filter fields to be operated on by a field callback. |
| public static interface | ReflectionUtils.MethodCallback
Action to take on each method. |
| public static interface | ReflectionUtils.MethodFilter
Callback optionally used to filter methods to be operated on by a method callback. |
| Modifier and Type | Field and Description |
|---|---|
| private static final String | CGLIB_RENAMED_METHOD_PREFIX
Naming prefix for CGLIB-renamed methods. |
| public static final ReflectionUtils. | COPYABLE_FIELDS
Pre-built FieldFilter that matches all non-static, non-final fields. |
| private static final Map | declaredFieldsCache
Cache for |
| private static final Map | declaredMethodsCache
Cache for |
| private static final Class | |
| private static final Field[] | |
| private static final Method[] | |
| private static final Object[] | |
| public static final ReflectionUtils. | USER_DECLARED_METHODS
Pre-built |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public static <T> Constructor | Returns: the constructor referencethe clazz to check clazz, Class<?>... the parameter types of the desired constructor parameterTypes)Obtain an accessible constructor for the given class and parameters. |
| public static void | |
| public static boolean | Returns: true if the exception can be thrown as-is;
false if it needs to be wrappedthe declaring method method, Class<?> the exception to throw exceptionType)Determine whether the given method explicitly declares the given exception or one of its superclasses, which means that an exception of that type can be propagated as-is within a reflective invocation. |
| public static void | doWithFields(Class<?>
the target class to analyze clazz, ReflectionUtils.the callback to invoke for each field fcInvoke the given callback on all fields in the target class, going up the class hierarchy to get all declared fields. |
| public static void | doWithFields(Class<?>
the target class to analyze clazz, ReflectionUtils.the callback to invoke for each field fc,the filter that determines the fields to apply the callback to ffInvoke the given callback on all fields in the target class, going up the class hierarchy to get all declared fields. |
| public static void | doWithLocalFields(Class<?>
the target class to analyze clazz, ReflectionUtils.the callback to invoke for each field fcInvoke the given callback on all locally declared fields in the given class. |
| public static void | doWithLocalMethods(Class<?>
the class to introspect clazz, ReflectionUtils.the callback to invoke for each method mcPerform the given callback operation on all matching methods of the given class, as locally declared or equivalent thereof (such as default methods on Java 8 based interfaces that the given class implements). |
| public static void | doWithMethods(Class<?>
the class to introspect clazz, ReflectionUtils.the callback to invoke for each method mcPerform the given callback operation on all matching methods of the given class and superclasses. |
| public static void | doWithMethods(Class<?>
the class to introspect clazz, ReflectionUtils.the callback to invoke for each method mc,the filter that determines the methods to apply the callback to mfPerform the given callback operation on all matching methods of the given class and superclasses (or given interface and super-interfaces). |
| private static List | |
| public static Field | |
| public static Field | Returns: the corresponding Field object, ornull if not foundthe class to introspect clazz, String the name of the field (may be name, Class<?> null if type is specified)the type of the field (may be type)null if name is specified)Attempt to find a |
| public static Field | Returns: the corresponding Field object, ornull if not foundthe class to introspect clazz, String the name of the field (with upper/lower case to be ignored) name)Attempt to find a |
| public static Method | Returns: the Method object, ornull if none foundthe class to introspect clazz, String the name of the method name)Attempt to find a |
| public static Method | Returns: the Method object, ornull if none foundthe class to introspect clazz, String the name of the method name, Class<?>... the parameter types of the method
(may be paramTypes)null to indicate any signature)Attempt to find a |
| public static Method[] | getAllDeclaredMethods(Class<?>
the class to introspect leafClass)Get all declared methods on the leaf class and all superclasses. |
| private static Field[] | Returns: the cached array of fieldsthe class to introspect clazz)This variant retrieves |
| public static Method[] | Returns: the cached array of methodsthe class to introspect clazz)Variant of |
| private static Method[] | |
| public static Object | Returns: the field's current valuethe field to get field, Object the target object from which to get the field
(or target)null for a static field)Get the field represented by the supplied |
| public static Method[] | getUniqueDeclaredMethods(Class<?>
the class to introspect leafClass)Get the unique set of declared methods on the leaf class and all superclasses. |
| public static Method[] | getUniqueDeclaredMethods(Class<?>
the class to introspect leafClass, ReflectionUtils.the filter that determines the methods to take into account mfGet the unique set of declared methods on the leaf class and all superclasses. |
| public static void | handleInvocationTargetException(InvocationTargetException
the invocation target exception to handle ex)Handle the given invocation target exception. |
| public static void | handleReflectionException(Exception
the reflection exception to handle ex)Handle the given reflection exception. |
| private static boolean | |
| public static Object | Returns: the invocation result, if anythe method to invoke method, Object the target object to invoke the method on target)Invoke the specified |
| public static Object | Returns: the invocation result, if anythe method to invoke method, Object the target object to invoke the method on target, Object... the invocation arguments (may be args)null)Invoke the specified |
| public static boolean | isCglibRenamedMethod(Method
the method to check renamedMethod)Determine whether the given method is a CGLIB 'renamed' method, following the pattern "CGLIB$methodName$0". |
| public static boolean | |
| public static boolean | |
| public static boolean | isObjectMethod(Method method)
Determine whether the given method is originally declared by |
| public static boolean | isPublicStaticFinal(Field
the field to check field)Determine whether the given field is a "public static final" constant. |
| public static boolean | |
| public static void | makeAccessible(Constructor<?>
the constructor to make accessible ctor)Make the given constructor accessible, explicitly setting it accessible if necessary. |
| public static void | makeAccessible(Method
the method to make accessible method)Make the given method accessible, explicitly setting it accessible if necessary. |
| public static void | makeAccessible(Field
the field to make accessible field)Make the given field accessible, explicitly setting it accessible if necessary. |
| public static void | rethrowException(Throwable
the exception to rethrow throwable)Rethrow the given |
| public static void | rethrowRuntimeException(Throwable
the exception to rethrow ex)Rethrow the given |
| public static void | setField(Field
the field to set field, Object the target object on which to set the field
(or target, Object null for a static field)the value to set (may be value)null)Set the field represented by the supplied field object on
the specified target object to the specified |
| public static void | shallowCopyFieldState(final Object src, final Object dest)
Given the source object and the destination, which must be the same class or a subclass, copy all fields, including inherited fields. |