public abstract class ReflectionUtils extends Object
| Constructor and Description |
|---|
ReflectionUtils() |
| Modifier and Type | Method and Description |
|---|---|
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 <T> T |
getFieldValue(Object object,
String fieldName)
|
static Class<?> |
getType(Object object,
String fieldName) |
static <T> T |
newInstance(Class<T> clazz)
Create a class for the specified type,.
|
static <T> T |
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) |
public static <T> T newInstance(Class<T> clazz)
T - the class to instantiate to be returnedclazz - the class to be instantiatedpublic 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 instantiatingpublic 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 setpublic 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.public static Class<?> getType(Object object, String fieldName)
object - fieldName - public static void setId(Identifiable identifiable, Long id)
Copyright © 2014. All rights reserved.