public class ReflectionEngine extends Object
The reflection engine is responsible for accessing the classes, the instances and members in a JVM.
Modifier and Type | Field and Description |
---|---|
static int |
cacheSize |
static Object |
RETURN_VOID |
Constructor and Description |
---|
ReflectionEngine() |
Modifier and Type | Method and Description |
---|---|
Object |
createArray(String fqn,
int[] dimensions) |
Class<?> |
getClass(Class<?> clazz,
String name) |
MethodInvoker |
getConstructor(Class<?> clazz,
Class<?>[] parameters) |
MethodInvoker |
getConstructor(String classFQN,
Object[] parameters) |
Field |
getField(Class<?> clazz,
String name) |
Field |
getField(Object obj,
String name) |
Field |
getField(String classFQN,
String name) |
Object |
getFieldValue(Object obj,
Field field)
Wrapper around Field.get
|
Method |
getMethod(Class<?> clazz,
String name) |
MethodInvoker |
getMethod(Class<?> clazz,
String name,
Class<?>[] parameters) |
MethodInvoker |
getMethod(Object object,
String name,
Object[] parameters) |
MethodInvoker |
getMethod(String classFQN,
String name,
Object[] parameters) |
String[] |
getPublicFieldNames(Object obj)
Retrieve the names of all the public fields in the obj
|
String[] |
getPublicMethodNames(Object obj)
Retrieve the names of all the public methods in the obj
|
String[] |
getPublicStaticClassNames(Class<?> clazz)
Retrieve the names of all the public static classes in the clazz
|
String[] |
getPublicStaticFieldNames(Class<?> clazz)
Retrieve the names of all the public static fields in the clazz
|
String[] |
getPublicStaticMethodNames(Class<?> clazz)
Retrieve the names of all the public static methods in the clazz
|
String[] |
getPublicStaticNames(Class<?> clazz)
Retrieve the names of all the public static fields, methods and
classes in the clazz
|
Object |
invoke(Object object,
MethodInvoker invoker,
Object[] parameters) |
void |
setFieldValue(Object obj,
Field field,
Object value)
Wrapper around Field.set
|
public static int cacheSize
public static final Object RETURN_VOID
public MethodInvoker getConstructor(Class<?> clazz, Class<?>[] parameters)
public MethodInvoker getConstructor(String classFQN, Object[] parameters)
public Field getField(Class<?> clazz, String name)
clazz
- name
- public Field getField(Object obj, String name)
obj
- name
- public Object getFieldValue(Object obj, Field field)
Wrapper around Field.get
obj
- field
- public MethodInvoker getMethod(Class<?> clazz, String name, Class<?>[] parameters)
public MethodInvoker getMethod(Object object, String name, Object[] parameters)
public MethodInvoker getMethod(String classFQN, String name, Object[] parameters)
public Object invoke(Object object, MethodInvoker invoker, Object[] parameters)
public void setFieldValue(Object obj, Field field, Object value)
Wrapper around Field.set
obj
- field
- value
- public String[] getPublicMethodNames(Object obj)
obj
- the object to inspectpublic String[] getPublicFieldNames(Object obj)
obj
- the object to inspectpublic String[] getPublicStaticFieldNames(Class<?> clazz)
clazz
- the object to inspectpublic String[] getPublicStaticMethodNames(Class<?> clazz)
clazz
- the object to inspectpublic String[] getPublicStaticClassNames(Class<?> clazz)
clazz
- the object to inspect