|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.jalios.util.ReflectUtil
public class ReflectUtil
Field Summary | |
---|---|
static String |
REVISION
|
Constructor Summary | |
---|---|
ReflectUtil()
|
Method Summary | |
---|---|
static void |
copyDeclaredFields(Object src,
Object dest)
Copy all fields (whatever access status, and on whatever superclass they were defined) that can be found on this class. |
static Object |
fieldGetter(Object instance,
Field field)
Return the return value of a getter call from a given field on a given instance |
static void |
fieldSetter(Object obj,
Field field,
Object fieldValue)
|
static Field[] |
getAllFields(Class<?> clazz)
Return a list of all fields (whatever access status, and on whatever superclass they were defined) that can be found on this class. |
static Field |
getField(Class<?> clazz,
String attName)
Returns a Field object that reflects the specified declared field of the class or interface represented by this Class object. |
static Object |
getFieldValue(Object instance,
Field field)
Returns the field value corresponding to the field argument |
static String |
getGetterMethodName(Field field)
Return the name of the getter method for a field. |
static String |
getSetterMethodName(Field field)
Return the name of the setter method for a field. |
static Map |
introspectFields(Class clazz)
Introspect a Class to retrieve public fields |
static Map |
introspectFields(Object obj)
Convenient method to introspect fields of an object |
static Map |
introspectFields(Object instance,
Map fields)
Introspect an Object by calling given fields |
static void |
setFieldValue(Object storable,
Field field,
Object fieldValue)
Set a field to a value |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String REVISION
Constructor Detail |
---|
public ReflectUtil()
Method Detail |
---|
public static String getGetterMethodName(Field field)
int status; -> getStatus() boolean isEnabled -> isEnabled();
field
- the fieldpublic static Field getField(Class<?> clazz, String attName)
clazz
- specifies the class or interfaceattName
- the name of the desired fieldpublic static Object getFieldValue(Object instance, Field field)
instance
- - the instance containing the fieldfield
- - the requested field
public static Object fieldGetter(Object instance, Field field)
instance
- field
- public static String getSetterMethodName(Field field)
int status; -> setStatus()
field
- the fieldpublic static void setFieldValue(Object storable, Field field, Object fieldValue)
storable
- - the instance containing the fieldfield
- - the field to setfieldValue
- - the new field valuepublic static void fieldSetter(Object obj, Field field, Object fieldValue)
public static Map introspectFields(Object obj)
obj
- the object to introspect
public static Map introspectFields(Class clazz)
clazz
- the class to introspect
public static Map introspectFields(Object instance, Map fields)
instance
- the instance to introspectfields
- a Map of FieldName / Field to call
public static Field[] getAllFields(Class<?> clazz)
Class.getDeclaredFields()
which ignores and super-classes, and Class.getFields()
which ignored non-public
fields.
clazz
- The class to introspect
public static void copyDeclaredFields(Object src, Object dest)
src
- Object to copydest
- Object to set
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |