I am writing a mapper to map fields of 2 different POJOs in java. I have used Dozer mapper for simple mapping but in this case, I have a slightly complex strategy when it comes to set the value to the destination object. The getter is simple, but instead it setting it directly, I want to do some processing on the value.
My question is, can I use dozer mapper for my cause? In case if its not possible, is it ok (from performance point of view) to use reflection to implement my own mapper (this is because I have defined the mapping in an xml file and dont want to hardcode it in the mapper class)?
<mapping>
<field>
<!-- source -->
<field-a name="cat">
<!-- destination -->
<field-b" name="dog">
</field>
</mapping>
Relevant to this xml, I want the following:
Source c;
Destination d;
d.setDog(someProcessing(c.getPsMessage()));
Note down the extra processing (someProcessing
) after getting the value and before setting it to the destination object.
Aucun commentaire:
Enregistrer un commentaire