开发者

Dozer - Mapping to a common destination class from two source classes

Here's my scenario. I have three simple classes: SourceClassA, SourceClassB & DestClass. I have two custom converters defined inside the mapping XML in the following way:

<mappings>开发者_Go百科
    <configuration>
        <custom-converters>
            <converter type="com.myproject.ClassAConverter">
                <class-a>com.myproject.SourceClassA</class-a>
                <class-b>com.myproject.DestClass</class-b>
            </converter>

            <converter type="com.myproject.ClassBConverter">
                <class-a>com.myproject.SourceClassB</class-a>
                <class-b>com.myproject.DestClass</class-b>
            </converter>
...
        </custom-converters>
    </configuration>
</mappings>

Is this kind of mapping valid at all ? Can we map to the same destination class from two different source classes using custom converters ?

In my case, when I tried this, the ClassBConverter is never invoked at all by Dozer during bean mapping. Any thoughts ?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜