|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.foxinmy.weixin4j.util.ReflectionUtil
public class ReflectionUtil
| Constructor Summary | |
|---|---|
ReflectionUtil()
|
|
| Method Summary | |
|---|---|
static Field |
getAccessibleField(Object object,
String fieldName)
|
static Set<Field> |
getAllField(Class<?> clazz)
|
static Class<?> |
getFieldGenericType(Object obj,
String fieldName)
获取字段的泛型参数类型 |
static String |
getFieldType(Object object,
String fieldName)
|
static Object |
getFieldValue(Object object,
String fieldName)
获取对象属性值,无视private/protected/getter |
static String |
getPackageName(Object obj)
获取包包名 |
static Object |
invokeGetterMethod(Object object,
String propertyName)
调用Getter方法 |
static Object |
invokeMethod(Object object,
String propertyName)
调用方法 |
static Object |
invokeMethod(Object object,
String propertyName,
Object... args)
|
static void |
invokeSetterMethod(Object object,
String propertyName,
Object propertyValue)
调用Setter方法 |
static void |
invokeSetterMethod(Object object,
String propertyName,
Object propertyValue,
Class<?> setterMethodClass)
调用Setter方法 |
static void |
setFieldValue(Object object,
String fieldName,
Object value)
设置对象属性值,无视private/protected/setter |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ReflectionUtil()
| Method Detail |
|---|
public static String getPackageName(Object obj)
obj -
public static Class<?> getFieldGenericType(Object obj,
String fieldName)
obj - fieldName -
public static Object invokeMethod(Object object,
String propertyName)
object - 对象propertyName - 属性名称
public static Object invokeMethod(Object object,
String propertyName,
Object... args)
public static Object invokeGetterMethod(Object object,
String propertyName)
throws Exception
object - 对象propertyName - 属性名称
SecurityException
NoSuchMethodException
InvocationTargetException
IllegalArgumentException
IllegalAccessException
Exception
public static void invokeSetterMethod(Object object,
String propertyName,
Object propertyValue)
object - 对象propertyName - 属性名称propertyValue - 属性值
public static void invokeSetterMethod(Object object,
String propertyName,
Object propertyValue,
Class<?> setterMethodClass)
object - 对象propertyName - 属性名称propertyValue - 属性值setterMethodClass - 参数类型
public static Object getFieldValue(Object object,
String fieldName)
object - 对象fieldName - 属性名称
public static void setFieldValue(Object object,
String fieldName,
Object value)
object - 对象fieldName - 属性名称
public static String getFieldType(Object object,
String fieldName)
public static Field getAccessibleField(Object object,
String fieldName)
public static Set<Field> getAllField(Class<?> clazz)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||