Reputation: 1114
Is there a way to exclude multiple fields in Dozer, when source and target classes are the same?
I am using it like this:
<mapping map-null="false" wildcard="true">
<class-a>com.abc</class-a>
<class-b>com.abc</class-b>
<field-exclude>
<a>field1</a>
<b>field1</b>
</field-exclude>
<field-exclude>
<a>field2</a>
<b>field2</b>
</field-exclude> ....
</mapping>
It seems so funny to write same name when it's known that it'll always be same for all... Is there any alternative?
Upvotes: 1
Views: 10442
Reputation: 37974
I found this post in Google, but I configure Dozer via annotations so the existing answer didn't help me.
In order to exclude a field from mapping via annotations use
@Mapping("this")
on the field.
Source: Dozer, how to ignore a field with annotation
Upvotes: 3
Reputation: 21
wildcard="false"
will do the trick. http://dozer.sourceforge.net/documentation/exclude.html
Upvotes: 2