How to dynamically add properties to class [closed]

China☆狼群 提交于 2019-12-01 11:14:22

I believe what you are asking for is not the right option here. Although in theory you can modify the byte code of your program to add a property dynamically as you describe, it is not a good idea at all.

I suggest you use a HashMap that maps a property name to its value and interactively modify that map.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!