Hi,
Is it possible to filter (or ignore) mappings of certain class fields based on field name?
I.E:
class Source {
private A field1;
private B field2;
protected Source(){}
public Source(A param1,B param2){...}
// Note: no setter methods
}
class Target {
private A filed1;
protected Target(){}
public Target(A param1){...}
// Note: no setter methods
}
modelMapper.getConfiguration()
//Does something like this exist?
.fieldFilter((sourceObj,sourceField) -> { return !sourceField.getName().equals("field2")}
I would like to make the mapping as strict as possible but yet have the options to configure which fields to ignore.
Following is my currently configuration.
modelMapper.getConfiguration()
.setFieldMatchingEnabled(true)
.setMatchingStrategy(MatchingStrategies.STRICT)
.setFieldAccessLevel(Configuration.AccessLevel.PRIVATE);
Thank you in advance for taking the time to view this question.