|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.jdroid.java.utils.ReflectionUtils
public abstract class ReflectionUtils
Reflection related utilities
| Constructor Summary | |
|---|---|
ReflectionUtils()
|
|
| Method Summary | ||
|---|---|---|
static Object |
get(Field field,
Object object)
|
|
static Object |
get(Object object,
String fieldName)
|
|
static Field |
getField(Class<?> clazz,
String fieldName)
Returns a Field from a class or any of its super classes. |
|
static Field |
getField(Object object,
String fieldName)
|
|
static
|
getFieldValue(Object object,
String fieldName)
Returns the value of a given Field from an Object. |
|
static Class<?> |
getType(Object object,
String fieldName)
|
|
static
|
newInstance(Class<T> clazz)
Create a class for the specified type,. |
|
static
|
newInstance(Class<T> clazz,
Collection<Class<?>> parameterTypes,
Collection<Object> parameterValues)
Create a class for the specified type, using the specified constructor with the passed parameters. |
|
static void |
set(Object object,
String expression,
Object value)
Set a value in the given object without using getters or setters |
|
static void |
setId(Identifiable identifiable,
Long id)
|
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ReflectionUtils()
| Method Detail |
|---|
public static <T> T newInstance(Class<T> clazz)
T - the class to instantiate to be returnedclazz - the class to be instantiated
public static <T> T newInstance(Class<T> clazz,
Collection<Class<?>> parameterTypes,
Collection<Object> parameterValues)
T - the class to instantiate to be returnedclazz - the class to be instantiatedparameterTypes - a constructor with this parameters will be used to instantiate the classparameterValues - parameter values to be used when instantiating
public static void set(Object object,
String expression,
Object value)
object - The object where we want to null the expressionexpression - The expression we want to nullvalue - The new value to set
public static Object get(Field field,
Object object)
field - object -
public static Object get(Object object,
String fieldName)
object - fieldName -
public static Field getField(Object object,
String fieldName)
object - fieldName -
public static Field getField(Class<?> clazz,
String fieldName)
Field from a class or any of its super classes.
clazz - The Class whose Field is looked forfieldName - The name of the Field to get
Field
public static <T> T getFieldValue(Object object,
String fieldName)
Field from an Object. Or null if the Object doesn't have a
Field with the given name.
T - The type of the valueobject - The Object whose value is being retrievedfieldName - The name of the Field
Field
public static Class<?> getType(Object object,
String fieldName)
object - fieldName -
public static void setId(Identifiable identifiable,
Long id)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||