Add get(Object target, String field) to ReflectionUtils.java

This commit is contained in:
hongqiaowei
2022-02-11 09:46:15 +08:00
parent d520beb065
commit bb280e3476

View File

@@ -33,4 +33,10 @@ public abstract class ReflectionUtils extends org.springframework.util.Reflectio
makeAccessible(f);
setField(f, target, value);
}
public static Object get(Object target, String field) {
Field f = findField(target.getClass(), field);
makeAccessible(f);
return getField(f, target);
}
}