Closed mmaryo closed 5 years ago
Hi, I understand this. I often think about providing a way to use ReMap in a less strict way - but I'm not sure how to integrate this in the API. I would like a way that you cannot accidentally mix the strict and the relaxed mapping mode.
Okay the omitAll()
method in the Mapper
with a documented warning is okay I think.
But adding this feature also for the Assert API doesn't seem to be right: expectOmitAll
feels too unspecific and leaves enough space for erroneously excluding fields.
Mapping.from(Customer.class) .to(Person.class) .reassign(Customer::getTitle) .to(Person::getSalutation) .omitAllTheRest() .mapper();
By using omitAllTheRest() (or omitAll()), remap continue works normally, but just skip the all fields mapping check It's a decision from the developer
what do you think ?
As I mentioned: The method Mapper.omitAll()
is fine for me, but I have to think about the AssertMapping
-part of the API as described above.
I not sure I can help you for AssertMapping But, great PR ! I am looking forward to the release
Cool.
I have an idea for the AssertMapping but I need a day to test it. If you have an idea your PR is welcome :)
I would suggest to do a release now so we get the feature early.
Release 4.1.5 is on its way. I will open an issue for AssertMapping.expectOthersToBeOmitted()
.
Hello
Sometime I just need to map some fields and I do not matter for the others and new It's tedious to omit each field
For exemple I create a "little" object with 6 or 7 fields and need to copie them from an object with 30 or 40 fields -> by using ReMap, it's long and boring to write mapping
What do you think about omitAll() ?