Package com.comphenix.protocol.reflect
Class ExactReflection
java.lang.Object
com.comphenix.protocol.reflect.ExactReflection
-
Method Summary
Modifier and TypeMethodDescriptionRetrieve anExactReflectionobject where scope restrictions are ignored.static ExactReflectionRetrieves an exact reflection instance from a given class.static ExactReflectionRetrieves an exact reflection instance from a given class.static ExactReflectionfromObject(Object reference)Retrieves an exact reflection instance from an object.static ExactReflectionfromObject(Object reference, boolean forceAccess)Retrieves an exact reflection instance from an object.Retrieve a field in the class hierachy by the given name.Retrieve the first method in the class hierachy with the given name and parameters.Class<?>Retrieve the source class we are searching.booleanDetermine if we are overriding scope restrictions and will also find private, protected or package members.
-
Method Details
-
fromClass
Retrieves an exact reflection instance from a given class.- Parameters:
source- - the class we'll use.- Returns:
- A fuzzy reflection instance.
-
fromClass
Retrieves an exact reflection instance from a given class.- Parameters:
source- - the class we'll use.forceAccess- - whether or not to override scope restrictions.- Returns:
- A fuzzy reflection instance.
-
fromObject
Retrieves an exact reflection instance from an object.- Parameters:
reference- - the object we'll use.- Returns:
- A fuzzy reflection instance that uses the class of the given object.
-
fromObject
Retrieves an exact reflection instance from an object.- Parameters:
reference- - the object we'll use.forceAccess- - whether or not to override scope restrictions.- Returns:
- A fuzzy reflection instance that uses the class of the given object.
-
getMethod
Retrieve the first method in the class hierachy with the given name and parameters.If
isForceAccess()is TRUE, we will also search for protected and private methods.- Parameters:
methodName- - the method name to find, or NULL to look for everything.parameters- - the parameters.- Returns:
- The first matched method.
- Throws:
IllegalArgumentException- If we cannot find a method by this name.
-
getField
Retrieve a field in the class hierachy by the given name.If
isForceAccess()is TRUE, we will also search for protected and private fields.- Parameters:
fieldName- - the field name. Cannot be NULL.- Returns:
- The first matched field.
-
forceAccess
Retrieve anExactReflectionobject where scope restrictions are ignored.- Returns:
- A copy of the current object.
-
isForceAccess
public boolean isForceAccess()Determine if we are overriding scope restrictions and will also find private, protected or package members.- Returns:
- TRUE if we are, FALSE otherwise.
-
getSource
Retrieve the source class we are searching.- Returns:
- The source.
-