Commit e0be76b0 authored by Quxl's avatar Quxl

x

parent f442605c
...@@ -102,10 +102,15 @@ public class ReflexUtil { ...@@ -102,10 +102,15 @@ public class ReflexUtil {
return executeMethod(method, obj); return executeMethod(method, obj);
} }
public static void writeField(String fieldName, Object obj, Object... args) { public static void writeField(String fieldName, Object obj, Object arg) {
Class<?> clz = obj.getClass(); try {
Method method = getWriteMethod(fieldName, clz); Class<?> clz = obj.getClass();
executeMethod(method, obj, args); Field field = clz.getDeclaredField(fieldName);
field.setAccessible(true);
field.set(obj, arg);
} catch (Exception e) {
throw new ReflectException("FieldSetError", e);
}
} }
public static Object readField(Field field, Object obj) { public static Object readField(Field field, Object obj) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment