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

This commit is contained in:
hongqiaowei
2022-02-11 09:46:15 +08:00
parent c938ed0d98
commit 5844419fd5

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);
}
}