Interface ReflectionAgent
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Provides reflection operations using the calling context of another class. This is useful for centralizing
which module to open oneself to instead of this Log4j Plugins module.
-
Method Summary
Modifier and TypeMethodDescriptiondefault ObjectgetFieldValue(@NonNull Field field, Object instance) default ObjectinvokeMethod(@NonNull Method method, Object instance, Object... args) voidmakeAccessible(@NonNull AccessibleObject object) InvokesAccessibleObject.setAccessible(boolean)from a class contained in a module that will be used to perform reflective operations.default <T> @NonNull TnewInstance(@NonNull Class<T> clazz) default <T> @NonNull TnewInstance(@NonNull Constructor<T> constructor, Object... args) default voidsetFieldValue(@NonNull Field field, Object instance, Object value)
-
Method Details
-
makeAccessible
InvokesAccessibleObject.setAccessible(boolean)from a class contained in a module that will be used to perform reflective operations.- Parameters:
object- the object to make accessible (never null)- Throws:
InaccessibleObjectException- if this cannot access the provided objectSecurityException- if the request is denied by the security manager
-
getFieldValue
-
setFieldValue
-
invokeMethod
-
newInstance
-
newInstance
-