推土机深度映射在地图中设置

时间:2014-04-15 06:53:08

标签: java deep-copy dozer

我有两个类Test1.javaTest2.java,其中fieldName类型为Map<String, Set<String>>。当我尝试使用dozer将 Test1 映射到 Test2 时,会抛出以下错误

Exception in thread "main" java.lang.ClassCastException: java.util.HashSet cannot be cast to java.util.List
at org.dozer.MappingProcessor.mapCollection(MappingProcessor.java:561)
at org.dozer.MappingProcessor.mapOrRecurseObject(MappingProcessor.java:434)
at org.dozer.MappingProcessor.mapMap(MappingProcessor.java:586)
at org.dozer.MappingProcessor.mapOrRecurseObject(MappingProcessor.java:395)
at org.dozer.MappingProcessor.mapFromFieldMap(MappingProcessor.java:342)
at org.dozer.MappingProcessor.mapField(MappingProcessor.java:288)
at org.dozer.MappingProcessor.map(MappingProcessor.java:248)
at org.dozer.MappingProcessor.map(MappingProcessor.java:197)
at org.dozer.MappingProcessor.map(MappingProcessor.java:187)
at org.dozer.MappingProcessor.map(MappingProcessor.java:133)
at org.dozer.MappingProcessor.map(MappingProcessor.java:128)
at org.dozer.DozerBeanMapper.map(DozerBeanMapper.java:127)
at com.paypal.offers.common.util.TestMain.main(TestMain.java:25)

为什么它无法识别util.Set的正确目标类型?我是否需要添加一些提示?

0 个答案:

没有答案