|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.sf.easyweb4j.util.ReflectionUtil
public class ReflectionUtil
Utility class to facilitate reflections in EasyWeb4J.
This class is not a part of EasyWeb4J API. Its behavior may change in future versions and hence its direct use in applications is discouraged.
| Constructor Summary | |
|---|---|
ReflectionUtil()
|
|
| Method Summary | |
|---|---|
static boolean |
containsProperty(Object obj,
String property)
Checks whether the given object contains the specified property. |
static Object |
getField(Class<?> clazz,
String fieldName,
Object source)
Gets the value of a field within the given object. |
static Object |
getField(Field field,
Object source)
Gets the value of a field within the given object. |
static Object |
readProperty(Object obj,
String property,
ModelIntrospector introspector)
Introspects the given Java Bean object and reads the value of the specified property. |
static Field |
resolveField(Class<?> clazz,
String fieldName)
Resolves a field on a class with the given name. |
static void |
setField(Field field,
Object target,
Object value)
Sets the value of a field within the given object. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ReflectionUtil()
| Method Detail |
|---|
public static Field resolveField(Class<?> clazz,
String fieldName)
Field
in classes.
clazz - The class whose field is to be resolved.fieldName - The name of the field to resolve.
public static void setField(Field field,
Object target,
Object value)
throws IllegalAccessException
field - The field to set.target - The target object on which the field is to be set.value - The value to set for the field.
IllegalAccessException - If setting the field value fails.
public static Object getField(Field field,
Object source)
throws IllegalAccessException
field - The field to get.source - The source object from which the field is to be read.
IllegalAccessException - If getting the field value fails.
public static Object getField(Class<?> clazz,
String fieldName,
Object source)
throws SecurityException,
NoSuchFieldException,
IllegalAccessException
clazz - The class to which the field belongs.fieldName - The name of the field to set.source - The source object from which the field is to be read.
NoSuchFieldException - If getting the field value fails.
SecurityException - If getting the field value fails.
IllegalAccessException - If getting the field value fails.
public static boolean containsProperty(Object obj,
String property)
throws IntrospectionException
obj - The object to introspect.property - The property to check for.
IntrospectionException - If introspection of the object fails.
public static Object readProperty(Object obj,
String property,
ModelIntrospector introspector)
throws IntrospectionException,
InvocationTargetException,
IllegalAccessException
Model,
it uses ModelIntrospector.readProperty(Model, String) to read the
value.
obj - The object to introspect.property - The property whose value is to be read.
IntrospectionException - If introspection of the object fails.
InvocationTargetException - If introspection of the object fails.
IllegalAccessException - If introspection of the object fails.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||