I am using Orika Mapper. I want to know that can I include or exclude the attributes while mapping using Orika Mapper. If it is possible then how to do the same?
You can include attributes simply by defining the mapping. Have a look at the User Guide.
You can use byDefault()
to automatically map fields with the same names, explicitly define two-way mappings using field("fieldA", "fieldB")
or one-way mappings using fieldAtoB("fieldA", "fieldB")
and fieldBtoA("fieldB", "fieldA")
.
If you want to explicitly exclude a field from mapping (eg. when using byDefault()
), you can use exclude("field")
. You can chain .exclude("field1").exclude("field2").exclude("field3")
multiple times to exclude multiple fields.