生成地图<字符串,字符串>从POJO字符串、地图、POJO、LT

由网友(情场老司机)分享简介:我有一个POJO,和(目前还未建)类,将返回它的列表。我想自动生成必要的POJO进行访问,地图上的code。这是一个好主意,是有可能自动做的,我需要手动为每一个POJO我想治疗这种方式做到这一点?I have a POJO, and a (currently not-yet-built) class that wil...

我有一个POJO,和(目前还未建)类,将返回它的列表。我想自动生成必要的POJO进行访问,地图上的code。这是一个好主意,是有可能自动做的,我需要手动为每一个POJO我想治疗这种方式做到这一点?

I have a POJO, and a (currently not-yet-built) class that will return Lists of it. I'd like to automatically generate the code necessary for the POJO to be accessed as a Map. Is this a good idea, is it possible to do automatically, and do I need to do this manually for every POJO I want to treat this way?

谢谢, 刘德华

推荐答案

您可以使用共享的beanutils BeanMap对于这一点。

You can use Commons BeanUtils BeanMap for this.

Map map = new BeanMap(someBean);

更新:因为这不是一种选择,由于Android的一些明显的库相关问题,这里有一个基本的开球例如你怎么可以用的

阅读全文

相关推荐

最新文章