Could Mapster notify about an unmapped property of the source object? #739
Replies: 2 comments 2 replies
-
Are you asking if there is a way to configure Mapster so that Name is mapped to Description, or are you asking if there is some way to be notified that the mapping (without any configuration) is creating a null value? Do you think that a runtime exception is really the best way to handle this rather than having unit tests that would catch this? |
Beta Was this translation helpful? Give feedback.
-
The issue would seem to be that you have various types and you want to map from type A to type B, and from type C to type D and you want to make sure that the types you want to map to have the same properties as the type you are mapping from. So this doesn't even need to involve Mapster. With xUnit you could do the following:
|
Beta Was this translation helpful? Give feedback.
-
I love Mapster because of I don't have to write any configuration. It just works. In most cases, this is an advantage.
But when renaming properties this sometimes becomes a drawback.
For instance:
When I rename
Name
property of classSource
, after adaptingd.Name
will benull
.There is no configuration so Mapster couldn't adapt
Description
to `Name. But I would like to know about this.So the question is: Is there any way to Mapster notifies about this or provides configuration for this behavior?
I couldn't find any setting which helps me.
Beta Was this translation helpful? Give feedback.
All reactions