Class JVMDriverReflectionDriver
java.lang.Object
nonapi.io.github.classgraph.reflection.ReflectionDriver
nonapi.io.github.classgraph.reflection.JVMDriverReflectionDriver
Reflection driver for the jvm-driver library, if it is
available at runtime. This library allows access to non-public fields and methods, circumventing encapsulation
and visibility controls, via a range of JVM-native tactics.
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class nonapi.io.github.classgraph.reflection.ReflectionDriver
ReflectionDriver.ClassMemberCache
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) Class
<?> Find a class by name.(package private) <T> Constructor<T>[]
getDeclaredConstructors
(Class<T> cls) Get declared constructors for class.(package private) Field[]
getDeclaredFields
(Class<?> cls) Get declared fields for class.(package private) Method[]
getDeclaredMethods
(Class<?> cls) Get declared methods for class.(package private) Object
Get the value of a non-static field, boxing the value if necessary.(package private) Object
getStaticField
(Field field) Get the value of a static field, boxing the value if necessary.(package private) Object
invokeMethod
(Object object, Method method, Object... args) Invoke a non-static method, boxing the result if necessary.(package private) Object
invokeStaticMethod
(Method method, Object... args) Invoke a static method, boxing the result if necessary.boolean
makeAccessible
(Object instance, AccessibleObject accessibleObject) Make a field or method accessible.(package private) void
Set the value of a non-static field, unboxing the value if necessary.(package private) void
setStaticField
(Field field, Object value) Set the value of a static field, unboxing the value if necessary.Methods inherited from class nonapi.io.github.classgraph.reflection.ReflectionDriver
findField, findInstanceField, findInstanceMethod, findMethod, findStaticField, findStaticMethod, isAccessible
-
Field Details
-
driver
-
getDeclaredMethods
-
getDeclaredConstructors
-
getDeclaredFields
-
getField
-
setField
-
invokeMethod
-
setAccessibleMethod
-
classFinder
-
-
Constructor Details
-
Method Details
-
makeAccessible
Description copied from class:ReflectionDriver
Make a field or method accessible.- Specified by:
makeAccessible
in classReflectionDriver
- Parameters:
instance
- the object instance, or null if static.accessibleObject
- the field or method.- Returns:
- true if successful.
-
findClass
Description copied from class:ReflectionDriver
Find a class by name.- Specified by:
findClass
in classReflectionDriver
- Parameters:
className
- the class name- Returns:
- the class reference
- Throws:
Exception
-
getDeclaredMethods
Description copied from class:ReflectionDriver
Get declared methods for class.- Specified by:
getDeclaredMethods
in classReflectionDriver
- Parameters:
cls
- the class- Returns:
- the declared methods
- Throws:
Exception
-
getDeclaredConstructors
Description copied from class:ReflectionDriver
Get declared constructors for class.- Specified by:
getDeclaredConstructors
in classReflectionDriver
- Type Parameters:
T
- the generic type- Parameters:
cls
- the class- Returns:
- the declared constructors
- Throws:
Exception
-
getDeclaredFields
Description copied from class:ReflectionDriver
Get declared fields for class.- Specified by:
getDeclaredFields
in classReflectionDriver
- Parameters:
cls
- the class- Returns:
- the declared fields
- Throws:
Exception
-
getField
Description copied from class:ReflectionDriver
Get the value of a non-static field, boxing the value if necessary.- Specified by:
getField
in classReflectionDriver
- Parameters:
object
- the object instance to get the field value fromfield
- the non-static field- Returns:
- the value of the field
- Throws:
Exception
-
setField
Description copied from class:ReflectionDriver
Set the value of a non-static field, unboxing the value if necessary.- Specified by:
setField
in classReflectionDriver
- Parameters:
object
- the object instance to get the field value fromfield
- the non-static fieldvalue
- the value to set- Throws:
Exception
-
getStaticField
Description copied from class:ReflectionDriver
Get the value of a static field, boxing the value if necessary.- Specified by:
getStaticField
in classReflectionDriver
- Parameters:
field
- the static field- Returns:
- the static field
- Throws:
Exception
-
setStaticField
Description copied from class:ReflectionDriver
Set the value of a static field, unboxing the value if necessary.- Specified by:
setStaticField
in classReflectionDriver
- Parameters:
field
- the static fieldvalue
- the value to set- Throws:
Exception
-
invokeMethod
Description copied from class:ReflectionDriver
Invoke a non-static method, boxing the result if necessary.- Specified by:
invokeMethod
in classReflectionDriver
- Parameters:
object
- the object instance to invoke the method onmethod
- the non-static methodargs
- the method arguments (ornew Object[0]
if there are no args)- Returns:
- the return value (possibly a boxed value)
- Throws:
Exception
-
invokeStaticMethod
Description copied from class:ReflectionDriver
Invoke a static method, boxing the result if necessary.- Specified by:
invokeStaticMethod
in classReflectionDriver
- Parameters:
method
- the static methodargs
- the method arguments (ornew Object[0]
if there are no args)- Returns:
- the return value (possibly a boxed value)
- Throws:
Exception
-