Commit e0be76b0 authored by Quxl's avatar Quxl

x

parent f442605c
......@@ -102,10 +102,15 @@ public class ReflexUtil {
return executeMethod(method, obj);
}
public static void writeField(String fieldName, Object obj, Object... args) {
Class<?> clz = obj.getClass();
Method method = getWriteMethod(fieldName, clz);
executeMethod(method, obj, args);
public static void writeField(String fieldName, Object obj, Object arg) {
try {
Class<?> clz = obj.getClass();
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) {
......
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