简体   繁体   English

映射到推土机中的设置映射解决方法

[英]Map to Set Mapping Workaround in Dozer

I'm trying to convert a Map to a Set in Dozer and I want to avoid having to write a custom converter at all costs. 我正在尝试在推土机中将地图转换为Set,我想避免不得不不惜一切代价编写一个自定义转换器。 Is there anyway I can use the get-method attribute in the configuration file to get the collection of values from the set (Losing the key values isn't an issue) and have Dozer convert from that? 无论如何,我可以使用配置文件中的get-method属性从集合中获取值的集合(丢失键值不是问题),然后让Dozer从中转换吗?

Here's what I've got so far, that isn't working 这是我到目前为止所没有的

<field>
<a is-accessible="true" get-method="values">sourceMap</a>
<b>targetSet</b>
<a-hint>Destination</a-hint>
<b-hint>OtherDestination</b-hint>
</field>

No, you must use a custom converter. 不,您必须使用自定义转换器。

This shows how collections can be mapped. 显示了如何映射集合。 You can map specific entries in a map to a non collection variable as described here 描述你可以在地图上非集合变量映射特定条目这里

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM