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 Object
getFieldValue
(@NonNull Field field, Object instance) default Object
invokeMethod
(@NonNull Method method, Object instance, Object... args) void
makeAccessible
(@NonNull AccessibleObject object) InvokesAccessibleObject.setAccessible(boolean)
from a class contained in a module that will be used to perform reflective operations.default <T> @NonNull T
newInstance
(@NonNull Class<T> clazz) default <T> @NonNull T
newInstance
(@NonNull Constructor<T> constructor, Object... args) default void
setFieldValue
(@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
-