Sometimes you want the "dragnet" functionality: throw anything at the DTO and just keep what sticks (silently fail).
Other times you may want to raise Exceptions when something doesn't map correctly.
One possible solution is to route exceptions to a dedicated method, e.g. handleException... then in a child class, you could re-throw them for a strict implementation.
Alternatively, maybe set something on the root object.
This has been implemented via the DtoStrict class -- extend it if you want an exception to be thrown if you attempt to write to any non-mapped location, either via the constructor or via any set operation.
Sometimes you want the "dragnet" functionality: throw anything at the DTO and just keep what sticks (silently fail).
Other times you may want to raise Exceptions when something doesn't map correctly.
One possible solution is to route exceptions to a dedicated method, e.g.
handleException
... then in a child class, you could re-throw them for a strict implementation.Alternatively, maybe set something on the root object.