Menu

#246 decide if to map specific field before

Dozer v5.3.2
open
nobody
9
2012-09-03
2012-09-03
Yachin
No

Hi'
I have a case that map between entity (JPA) to DTO object,
I want to decide if to do a mapping to a specific field.
I want to check the LAZY option:
In case we defined the field as LAZY - do not map this field.
I guess that the place to insert code that retrieve boolean is
under MappingProcessor -> mapField -> line ~253
after:
if (fieldMapping instanceof ExcludeFieldMap) {
return;
}

inserting something like:

if (customFieldMapper.skipMapField(srcObj, destObj, srcFieldValue, fieldMapping.getClassMap(), fieldMapping)) {
return;
}

CustomFieldMapper:

add the method: boolean skipMapField(Object source, Object destination, Object sourceFieldValue, ClassMap classMap, FieldMap fieldMapping);

and add this method into the

Discussion

  • Yachin

    Yachin - 2012-09-03
    • priority: 5 --> 9
     
  • Yachin

    Yachin - 2012-09-03
    • labels: --> Mapping Process Improvement
    • milestone: --> 891574
     
  • Yachin

    Yachin - 2012-09-03
    • milestone: 891574 --> Dozer v5.3.2
     

Log in to post a comment.

MongoDB Logo MongoDB