public class ExactReflection
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
ExactReflection |
forceAccess()
Retrieve an
ExactReflection object where scope restrictions are ignored. |
static ExactReflection |
fromClass(java.lang.Class<?> source)
Retrieves an exact reflection instance from a given class.
|
static ExactReflection |
fromClass(java.lang.Class<?> source,
boolean forceAccess)
Retrieves an exact reflection instance from a given class.
|
static ExactReflection |
fromObject(java.lang.Object reference)
Retrieves an exact reflection instance from an object.
|
static ExactReflection |
fromObject(java.lang.Object reference,
boolean forceAccess)
Retrieves an exact reflection instance from an object.
|
java.lang.reflect.Field |
getField(java.lang.String fieldName)
Retrieve a field in the class hierachy by the given name.
|
java.lang.reflect.Method |
getMethod(java.lang.String methodName,
java.lang.Class<?>... parameters)
Retrieve the first method in the class hierachy with the given name and parameters.
|
java.lang.Class<?> |
getSource()
Retrieve the source class we are searching.
|
boolean |
isForceAccess()
Determine if we are overriding scope restrictions and will also find
private, protected or package members.
|
public static ExactReflection fromClass(java.lang.Class<?> source)
source
- - the class we'll use.public static ExactReflection fromClass(java.lang.Class<?> source, boolean forceAccess)
source
- - the class we'll use.forceAccess
- - whether or not to override scope restrictions.public static ExactReflection fromObject(java.lang.Object reference)
reference
- - the object we'll use.public static ExactReflection fromObject(java.lang.Object reference, boolean forceAccess)
reference
- - the object we'll use.forceAccess
- - whether or not to override scope restrictions.public java.lang.reflect.Method getMethod(java.lang.String methodName, java.lang.Class<?>... parameters)
If isForceAccess()
is TRUE, we will also search for protected and private methods.
methodName
- - the method name to find, or NULL to look for everything.parameters
- - the parameters.java.lang.IllegalArgumentException
- If we cannot find a method by this name.public java.lang.reflect.Field getField(java.lang.String fieldName)
If isForceAccess()
is TRUE, we will also search for protected and private fields.
fieldName
- - the field name. Cannot be NULL.public ExactReflection forceAccess()
ExactReflection
object where scope restrictions are ignored.public boolean isForceAccess()
public java.lang.Class<?> getSource()