Does ModelMapper(http://modelmapper.org/) support what exclude property? If the value is null.
I just found PropertyMap out. but It is a constraint to me. because I have to describe a specific property that I want.
Like this.
ModelMapper modelMapper = new ModelMapper();
modelMapper.addMappings(new PropertyMap<TestObject, TestObject>() {
@Override
protected void configure() {
when(Conditions.isNull()).skip().setName(source.getName());
when(Conditions.isNull()).skip().set...(source.get...());
when(Conditions.isNull()).skip().set...(source.get...());
when(Conditions.isNull()).skip().set...(source.get...());
when(Conditions.isNull()).skip().set...(source.get...());
when(Conditions.isNull()).skip().set...(source.get...());
}
});
In my case, I have a lot of property and verbose. How to exclude mapping property if they are null from all them. Is there more comfortable solution?
thanks.