ReflectionUtils
Types
Link copied to clipboard
Callback interface invoked on each field in the hierarchy.
Link copied to clipboard
Callback optionally used to filter fields to be operated on by a field callback.
Link copied to clipboard
Record containing handler information extracted from annotations.
Link copied to clipboard
Action to take on each method.
Link copied to clipboard
Callback optionally used to filter methods to be operated on by a method callback.
Properties
Link copied to clipboard
Pre-built FieldFilter that matches all non-static, non-final fields.
Link copied to clipboard
Pre-built MethodFilter that matches all non-bridge non-synthetic methods which are not declared on
java.lang.Object.Functions
Link copied to clipboard
open fun <T> accessibleConstructor(clazz: Class<T>, parameterTypes: Array<Class<out Any>>): Constructor<T>
Obtain an accessible constructor for the given class and parameters.
Link copied to clipboard
Clear the internal method/field cache.
Link copied to clipboard
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.
Link copied to clipboard
open fun doWithFields(clazz: Class<out Any>, fc: ReflectionUtils.FieldCallback, @Nullable ff: @Nullable ReflectionUtils.FieldFilter)
Invoke the given callback on all fields in the target class, going up the class hierarchy to get all declared fields.
Link copied to clipboard
Invoke the given callback on all locally declared fields in the given class.
Link copied to clipboard
Perform 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).
Link copied to clipboard
Perform the given callback operation on all matching methods of the given class and superclasses.
open fun doWithMethods(clazz: Class<out Any>, mc: ReflectionUtils.MethodCallback, @Nullable mf: @Nullable ReflectionUtils.MethodFilter)
Perform the given callback operation on all matching methods of the given class and superclasses (or given interface and super-interfaces).
Link copied to clipboard
Link copied to clipboard
@Nullable
Find a single Annotation of
annotationType on the supplied Class, traversing its interfaces, annotations, and superclasses if the annotation is not directly present on the given class itself.@Nullable
Find a single Annotation of
annotationType on the supplied Method, traversing its super methods if the annotation is not directly present on the given method itself.Link copied to clipboard
Link copied to clipboard
Attempt to find a Method on the supplied class with the supplied name and no parameters.
@Nullable
Attempt to find a Method on the supplied class with the supplied name and parameter types.
Link copied to clipboard
open fun findParameterizedType(concreteClass: Class<out Any>, rawType: Class<out Any>): ParameterizedType
Walks the type hierarchy to find where the given rawType interface was parameterized.
Link copied to clipboard
Get all declared methods on the leaf class and all superclasses.
Link copied to clipboard
Variant of getDeclaredMethods that uses a local cache in order to avoid new Method instances.
Link copied to clipboard
open fun getUniqueDeclaredMethods(leafClass: Class<out Any>, @Nullable mf: @Nullable ReflectionUtils.MethodFilter): Array<Method>
Get the unique set of declared methods on the leaf class and all superclasses.
Link copied to clipboard
Handle the given invocation target exception.
Link copied to clipboard
Handle the given reflection exception.
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Invoke the specified Method against the supplied target object with no arguments.
@Nullable
Invoke the specified Method against the supplied target object with the supplied arguments.
Link copied to clipboard
Determine whether the given method is a CGLIB 'renamed' method, following the pattern "CGLIB$methodName$0".
Link copied to clipboard
Determine whether the given method is an "equals" method.
Link copied to clipboard
Determine whether the given method is a "hashCode" method.
Link copied to clipboard
Link copied to clipboard
Determine whether the given method is originally declared by Object.
Link copied to clipboard
Determine whether the given field is a "public static final" constant.
Link copied to clipboard
Determine whether the given method is a "toString" method.
Link copied to clipboard
Make the given constructor accessible, explicitly setting it accessible if necessary.
Make the given field accessible, explicitly setting it accessible if necessary.
Make the given method accessible, explicitly setting it accessible if necessary.
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Rethrow the given exception, which is presumably the target exception of an InvocationTargetException.
Link copied to clipboard
Rethrow the given exception, which is presumably the target exception of an InvocationTargetException.
Link copied to clipboard
Set the field represented by the supplied field object on the specified target object to the specified
value.Link copied to clipboard
Given the source object and the destination, which must be the same class or a subclass, copy all fields, including inherited fields.