public class FuzzyReflection
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
MINECRAFT_OBJECT
Matches a Minecraft object.
|
Constructor and Description |
---|
FuzzyReflection(java.lang.Class<?> source,
boolean forceAccess) |
Modifier and Type | Method and Description |
---|---|
static FuzzyReflection |
fromClass(java.lang.Class<?> source)
Retrieves a fuzzy reflection instance from a given class.
|
static FuzzyReflection |
fromClass(java.lang.Class<?> source,
boolean forceAccess)
Retrieves a fuzzy reflection instance from a given class.
|
static FuzzyReflection |
fromObject(java.lang.Object reference)
Retrieves a fuzzy reflection instance from an object.
|
static FuzzyReflection |
fromObject(java.lang.Object reference,
boolean forceAccess)
Retrieves a fuzzy reflection instance from an object.
|
java.lang.reflect.Field |
getFieldByName(java.lang.String nameRegex)
Retrieves a field by name.
|
java.lang.reflect.Field |
getFieldByType(java.lang.String typeRegex)
Retrieves a field by type.
|
java.lang.reflect.Field |
getFieldByType(java.lang.String typeRegex,
java.util.Set<java.lang.Class> ignored)
Retrieves a field by type.
|
java.util.Set<java.lang.reflect.Field> |
getFields()
Retrieves all private and public fields in declared order (after JDK 1.5).
|
java.lang.reflect.Method |
getMethodByName(java.lang.String nameRegex)
Retrieves a method by looking at its name.
|
java.lang.reflect.Method |
getMethodByParameters(java.lang.String name,
java.lang.Class<?>... args)
Retrieves a method by looking at the parameter types only.
|
java.lang.reflect.Method |
getMethodByParameters(java.lang.String name,
java.lang.Class<?> returnType,
java.lang.Class<?>[] args)
Retrieves a method by looking at the parameter types and return type only.
|
java.util.Set<java.lang.reflect.Method> |
getMethods()
Retrieves all private and public methods in declared order (after JDK 1.5).
|
java.lang.Class<?> |
getSource()
Retrieves the underlying class.
|
boolean |
isForceAccess()
Retrieves whether or not not to override any scope restrictions.
|
void |
setForceAccess(boolean forceAccess)
Sets whether or not not to override any scope restrictions.
|
public static java.lang.String MINECRAFT_OBJECT
public FuzzyReflection(java.lang.Class<?> source, boolean forceAccess)
public static FuzzyReflection fromClass(java.lang.Class<?> source)
source
- - the class we'll use.public static FuzzyReflection fromClass(java.lang.Class<?> source, boolean forceAccess)
source
- - the class we'll use.forceAccess
- - whether or not to override scope restrictions.public static FuzzyReflection fromObject(java.lang.Object reference)
reference
- - the object we'll use.public static FuzzyReflection fromObject(java.lang.Object reference, boolean forceAccess)
reference
- - the object we'll use.forceAccess
- - whether or not to override scope restrictions.public java.lang.Class<?> getSource()
public java.lang.reflect.Method getMethodByName(java.lang.String nameRegex)
nameRegex
- - regular expression that will match method names.public java.lang.reflect.Method getMethodByParameters(java.lang.String name, java.lang.Class<?>... args)
name
- - potential name of the method. Only used by the error mechanism.args
- - parameter types of the method to find.public java.lang.reflect.Method getMethodByParameters(java.lang.String name, java.lang.Class<?> returnType, java.lang.Class<?>[] args)
name
- - potential name of the method. Only used by the error mechanism.returnType
- - return type of the method to find.args
- - parameter types of the method to find.public java.lang.reflect.Field getFieldByName(java.lang.String nameRegex)
nameRegex
- - regular expression that will match a field name.public java.lang.reflect.Field getFieldByType(java.lang.String typeRegex)
Note that the type is matched using the full canonical representation, i.e.:
typeRegex
- - regular expression that will match the field type.public java.lang.reflect.Field getFieldByType(java.lang.String typeRegex, java.util.Set<java.lang.Class> ignored)
Note that the type is matched using the full canonical representation, i.e.:
typeRegex
- - regular expression that will match the field type.ignored
- - types to ignore.public java.util.Set<java.lang.reflect.Field> getFields()
public java.util.Set<java.lang.reflect.Method> getMethods()
public boolean isForceAccess()
public void setForceAccess(boolean forceAccess)
forceAccess
- - TRUE if we override scope, FALSE otherwise.