关于反射
来源:6-7 缓存系统常量数据

xu520812
2022-05-21
老师这里为什么要反射动态赋值,没想明白
Class constant= constants.getClass();
Field field = constants.getClass().getDeclaredField(key);
field.set(constant,value);
写回答
1回答
-
神思者
2022-05-21
假设从HashMap中取出30个数据给30个变量赋值,用反射赋值更简单,几句话就能搞定
012022-05-24
相似问题