Class Reflection
java.lang.Object
org.apache.openjpa.enhance.Reflection
Reflection utilities used to support and augment enhancement. Used both
at enhancement time and at runtime.
- Author:
- Abe White
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic FieldReturn the field with the given name, optionally throwing an exception if none.static MethodfindGetter(Class cls, String prop, boolean mustExist) Return the getter method matching the given property name, optionally throwing an exception if none.static MethodfindSetter(Class cls, String prop, boolean mustExist) Return the setter method matching the given property name, optionally throwing an exception if none.static MethodfindSetter(Class cls, String prop, Class param, boolean mustExist) Return the setter method matching the given property name, optionally throwing an exception if none.static ObjectReturn the value of the given field in the given object.static ObjectReturn the return value of the given getter in the given object.Gets all bean-style property names of the given Class or its superclass.static booleangetBoolean(Object target, Field field) Return the value of the given field in the given object.static booleangetBoolean(Object target, Method getter) Return the return value of the given getter in the given object.static byteReturn the value of the given field in the given object.static byteReturn the return value of the given getter in the given object.static charReturn the value of the given field in the given object.static charReturn the return value of the given getter in the given object.static ClassGets the declaring class of the given method signature but also checks if the method is declared in an interface.static MethodgetDeclaringMethod(Class c, Method m) Gets the method in the given class that has the same signature of the given method, if exists.static doubleReturn the value of the given field in the given object.static doubleReturn the return value of the given getter in the given object.static <T> Set<T> getFieldValues(Class c, int mods, Class<T> t) Gets values of all field f the given class such that f exactly match the given modifiers and are of given type (Object implies any type) unless f is annotated asReflectable.static floatReturn the value of the given field in the given object.static floatReturn the return value of the given getter in the given object.static intReturn the value of the given field in the given object.static intReturn the return value of the given getter in the given object.static longReturn the value of the given field in the given object.static longReturn the return value of the given getter in the given object.Gets all public field names of the given Class.static shortReturn the value of the given field in the given object.static shortReturn the return value of the given getter in the given object.static ObjectGet the value of the given named field or a corresponding getter method.static voidSet the value of the given field in the given object.static voidSet the value of the given field in the given object.static voidSet the value of the given field in the given object.static voidSet the value of the given field in the given object.static voidSet the value of the given field in the given object.static voidSet the value of the given field in the given object.static voidSet the value of the given field in the given object.static voidSet the value of the given field in the given object.static voidSet the value of the given field in the given object.static voidSet the value of the given field in the given object.static voidSet the value of the given field in the given object.static voidSet the value of the given field in the given object.static voidSet the value of the given field in the given object.static voidSet the value of the given field in the given object.static voidSet the value of the given field in the given object.static voidSet the value of the given field in the given object.static voidSet the value of the given field in the given object.static voidSet the value of the given field in the given object.static voidInvoke the given setter on the given object.static voidInvoke the given setter on the given object.static voidInvoke the given setter on the given object.static voidInvoke the given setter on the given object.static voidInvoke the given setter on the given object.static voidInvoke the given setter on the given object.static voidInvoke the given setter on the given object.static voidInvoke the given setter on the given object.static voidInvoke the given setter on the given object.
-
Constructor Details
-
Reflection
public Reflection()
-
-
Method Details
-
findGetter
-
findSetter
-
findSetter
-
findField
-
get
-
getValue
Get the value of the given named field or a corresponding getter method.- Returns:
- null if the field does not exist and mustExist is set to false or the given target is null.
- Throws:
UserException- if mustExist is true and the field or getter method is non-existent
-
getBoolean
-
getByte
-
getChar
-
getDouble
-
getFloat
-
getInt
-
getLong
-
getShort
-
get
-
getBoolean
-
getByte
-
getChar
-
getDouble
-
getFloat
-
getInt
-
getLong
-
getShort
-
set
-
set
-
set
-
set
-
set
-
set
-
set
-
set
-
set
-
set
-
set
-
set
-
set
-
set
-
set
-
set
-
set
-
set
-
set
-
set
-
set
-
set
-
set
-
set
-
set
-
set
-
set
-
getBeanStylePropertyNames
Gets all bean-style property names of the given Class or its superclass. A bean-style property 'abc' exists in Class C iff C has declared following pair of methods: public void setAbc(Y y) or public C setAbc(Y y) public Y getAbc(); If a getter property is annotated withReflectable, then it is ignored. -
getPublicFieldNames
-
getFieldValues
Gets values of all field f the given class such that f exactly match the given modifiers and are of given type (Object implies any type) unless f is annotated asReflectable. -
getDeclaringClass
-
getDeclaringMethod
-