mirror of
https://github.com/dromara/RuoYi-Vue-Plus.git
synced 2025-09-24 07:19:46 +08:00
update 升级 hutool 5.7.1 适配工具类
This commit is contained in:
@ -4,6 +4,7 @@ import cn.hutool.core.util.ReflectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 反射工具类. 提供调用getter/setter方法, 访问私有变量, 调用私有方法, 获取泛型类型Class, 被AOP过的真实类等工具函数.
|
||||
@ -37,13 +38,13 @@ public class ReflectUtils extends ReflectUtil {
|
||||
*/
|
||||
public static <E> void invokeSetter(Object obj, String propertyName, E value) {
|
||||
Object object = obj;
|
||||
String[] names = StrUtil.split(propertyName, ".");
|
||||
for (int i = 0; i < names.length; i++) {
|
||||
if (i < names.length - 1) {
|
||||
String getterMethodName = GETTER_PREFIX + StrUtil.upperFirst(names[i]);
|
||||
List<String> names = StrUtil.split(propertyName, ".");
|
||||
for (int i = 0; i < names.size(); i++) {
|
||||
if (i < names.size() - 1) {
|
||||
String getterMethodName = GETTER_PREFIX + StrUtil.upperFirst(names.get(i));
|
||||
object = invoke(object, getterMethodName);
|
||||
} else {
|
||||
String setterMethodName = SETTER_PREFIX + StrUtil.upperFirst(names[i]);
|
||||
String setterMethodName = SETTER_PREFIX + StrUtil.upperFirst(names.get(i));
|
||||
Method method = getMethodByName(object.getClass(), setterMethodName);
|
||||
invoke(object, method, value);
|
||||
}
|
||||
|
Reference in New Issue
Block a user