Class RuntimeReflection
- Since:
- 19.0
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidDeprecated.static voidDeprecated.Useregister(Field...)instead.static voidMakes the provided classes available for reflection at run time.static voidregister(Executable... methods) Makes the provided methods available for reflection at run time.static voidMakes the provided fields available for reflection at run time.static voidregisterAllClasses(Class<?> declaringClass) Allows callingClass.getClasses()on the provided class at run time.static voidregisterAllConstructors(Class<?> declaringClass) Allows callingClass.getConstructors()on the provided class at run time.static voidregisterAllDeclaredClasses(Class<?> declaringClass) Allows callingClass.getDeclaredClasses()on the provided class at run time.static voidregisterAllDeclaredConstructors(Class<?> declaringClass) Allows callingClass.getDeclaredConstructors()on the provided class at run time.static voidregisterAllDeclaredFields(Class<?> declaringClass) Allows callingClass.getDeclaredFields()on the provided class at run time.static voidregisterAllDeclaredMethods(Class<?> declaringClass) Allows callingClass.getDeclaredMethods()on the provided class at run time.static voidregisterAllFields(Class<?> declaringClass) Allows callingClass.getFields()on the provided class at run time.static voidregisterAllMethods(Class<?> declaringClass) Allows callingClass.getMethods()on the provided class at run time.static voidregisterAllNestMembers(Class<?> declaringClass) Allows callingClass.getNestMembers()on the provided class at run time.static voidregisterAllPermittedSubclasses(Class<?> declaringClass) Allows callingClass.getPermittedSubclasses()on the provided class at run time.static voidregisterAllRecordComponents(Class<?> declaringClass) Allows callingClass.getRecordComponents()on the provided class at run time.static voidregisterAllSigners(Class<?> declaringClass) Allows callingClass.getSigners()on the provided class at run time.static voidregisterAsQueried(Executable... methods) Makes the provided methods available for reflection queries at run time.static voidregisterClassLookup(String className) Makes the provided class available for reflection at run time.static voidregisterConstructorLookup(Class<?> declaringClass, Class<?>... parameterTypes) Makes the provided constructor available for reflection queries at run time.static voidregisterFieldLookup(Class<?> declaringClass, String fieldName) Makes the provided field available for reflection at run time.static voidregisterForReflectiveInstantiation(Class<?>... classes) Makes the provided classes available for reflective instantiation byClass.newInstance().static voidregisterMethodLookup(Class<?> declaringClass, String methodName, Class<?>... parameterTypes) Makes the provided method available for reflection queries at run time.
-
Method Details
-
register
Makes the provided classes available for reflection at run time. A call toClass.forName(String)for the names of the classes will return the classes at run time.This API is deprecated; use the
ReflectiveAccessinstead.- Since:
- 19.0
-
registerClassLookup
Makes the provided class available for reflection at run time. A call toClass.forName(String)for the name of the class will return the class (if it exists) or aClassNotFoundExceptionat run time.This API is deprecated; use the
ReflectiveAccessinstead.- Since:
- 23.0
-
register
Makes the provided methods available for reflection at run time. The methods will be returned byClass.getMethod(String, Class...),Class.getDeclaredMethod(String, Class[]), and all the other methods onClassthat return a single method.This API is deprecated; use the
ReflectiveAccessinstead.- Since:
- 19.0
-
registerAsQueried
Makes the provided methods available for reflection queries at run time. The methods will be returned byClass.getMethod(String, Class...),Class.getDeclaredMethod(String, Class[]), and all the other methods onClassthat return a single method, but will not be invocable and will not be considered reachable.This API is deprecated; use the
ReflectiveAccessinstead.- Since:
- 21.3
-
registerMethodLookup
public static void registerMethodLookup(Class<?> declaringClass, String methodName, Class<?>... parameterTypes) Makes the provided method available for reflection queries at run time. The method will be returned byClass.getMethod(String, Class...),Class.getDeclaredMethod(String, Class[]), and all the other methods onClassthat return a single method, but will not be invocable and will not be considered reachable. If the method doesn't exist aNoSuchMethodExceptionwill be thrown when calling these methods at run-time.This API is deprecated; use the
ReflectiveAccessinstead.- Since:
- 23.0
-
registerConstructorLookup
Makes the provided constructor available for reflection queries at run time. The constructor will be returned byClass.getConstructor(Class...),Class.getDeclaredConstructor(Class[]), and all the other methods onClassthat return a single constructor, but will not be invocable and will not be considered reachable. If the constructor doesn't exist aNoSuchMethodExceptionwill be thrown when calling these methods at run-time.This API is deprecated; use the
ReflectiveAccessinstead.- Since:
- 23.0
-
register
Makes the provided fields available for reflection at run time. The fields will be returned byClass.getField(String),Class.getDeclaredField(String),and all the other methods onClassthat return a single field.This API is deprecated; use the
ReflectiveAccessinstead.- Since:
- 19.0
-
registerFieldLookup
Makes the provided field available for reflection at run time. The field will be returned byClass.getField(String),Class.getDeclaredField(String), and all the other methods onClassthat return a single field. If the field doesn't exist aNoSuchFieldExceptionwill be thrown when calling these methods at run-time.This API is deprecated; use the
ReflectiveAccessinstead.- Since:
- 19.0
-
registerAllClasses
Allows callingClass.getClasses()on the provided class at run time.This API is deprecated; use the
ReflectiveAccessinstead.- Since:
- 23.0
-
registerAllDeclaredClasses
Allows callingClass.getDeclaredClasses()on the provided class at run time.This API is deprecated; use the
ReflectiveAccessinstead.- Since:
- 23.0
-
registerAllMethods
Allows callingClass.getMethods()on the provided class at run time. The methods will also be registered for individual queries.This API is deprecated; use the
ReflectiveAccessinstead.- Since:
- 23.0
-
registerAllDeclaredMethods
Allows callingClass.getDeclaredMethods()on the provided class at run time. The methods will also be registered for individual queries.This API is deprecated; use the
ReflectiveAccessinstead.- Since:
- 23.0
-
registerAllConstructors
Allows callingClass.getConstructors()on the provided class at run time. The constructors will also be registered for individual queries.This API is deprecated; use the
ReflectiveAccessinstead.- Since:
- 23.0
-
registerAllDeclaredConstructors
Allows callingClass.getDeclaredConstructors()on the provided class at run time. The constructors will also be registered for individual queries.This API is deprecated; use the
ReflectiveAccessinstead.- Since:
- 23.0
-
registerAllFields
Allows callingClass.getFields()on the provided class at run time. The fields will also be registered for individual queries.This API is deprecated; use the
ReflectiveAccessinstead.- Since:
- 23.0
-
registerAllDeclaredFields
Allows callingClass.getDeclaredFields()on the provided class at run time. The fields will also be registered for individual queries.This API is deprecated; use the
ReflectiveAccessinstead.- Since:
- 23.0
-
registerAllNestMembers
Allows callingClass.getNestMembers()on the provided class at run time.This API is deprecated; use the
ReflectiveAccessinstead.- Since:
- 23.0
-
registerAllPermittedSubclasses
Allows callingClass.getPermittedSubclasses()on the provided class at run time.This API is deprecated; use the
ReflectiveAccessinstead.- Since:
- 23.0
-
registerAllRecordComponents
Allows callingClass.getRecordComponents()on the provided class at run time.This API is deprecated; use the
ReflectiveAccessinstead.- Since:
- 23.0
-
registerAllSigners
Allows callingClass.getSigners()on the provided class at run time.This API is deprecated; use the
ReflectiveAccessinstead.- Since:
- 23.0
-
register
Deprecated.Useregister(Field...)instead. ParameterfinalIsWritableno longer serves a purpose.- Since:
- 19.0
-
register
@Deprecated(since="21.1") public static void register(boolean finalIsWritable, boolean allowUnsafeAccess, Field... fields) Deprecated.Useregister(Field...)instead. ParametersfinalIsWritableandallowUnsafeAccessno longer serve a purpose.- Since:
- 21.0
-
registerForReflectiveInstantiation
Makes the provided classes available for reflective instantiation byClass.newInstance(). This is equivalent to registering the nullary constructors of the classes.This API is deprecated; use the
ReflectiveAccessinstead.- Since:
- 19.0
-
register(Field...)instead.