带有地图的 BeanUtils
如何将 BeanUtils setProperty 方法与 Maps 一起使用。
例如,这个方法: public void setAddress(String类型,Address地址); 可以使用以下方式设置: BeanUtils.setProperty(beanObject, "地址(家)", addressObject );
但是如果我要设置的对象是一个Map,可以吗?如何?
How can I use the BeanUtils setProperty method with Maps.
For example, this method:
public void setAddress(String type, Address address);
Can be setted using:
BeanUtils.setProperty(beanObject, "address(home)", addressObject );
But if the object I want to set is a Map, is it possible? how?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用映射语法
foo(bar)
(bar
是映射foo
的键):输出:
Use the Map syntax
foo(bar)
(bar
is the key of the mapfoo
):Output: