Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mapper: Define when to resave #19

Closed
ljacqu opened this issue Oct 18, 2016 · 2 comments
Closed

Mapper: Define when to resave #19

ljacqu opened this issue Oct 18, 2016 · 2 comments
Milestone

Comments

@ljacqu
Copy link
Member

ljacqu commented Oct 18, 2016

The mapper can swallow exceptions when some subentry is invalid and will skip it, but it should be somehow possible to find out if such a case happened, e.g. to force a save of the configuration.

@ljacqu ljacqu added this to the 1.1 Release milestone Aug 5, 2018
@ljacqu ljacqu modified the milestones: 1.1 Release, 1.2 Release Sep 4, 2018
@ljacqu
Copy link
Member Author

ljacqu commented Aug 7, 2019

I think this is interesting beyond the mapper itself. One way would be to wrap the value from Property#determineValue so that the value can be returned as well as a signal to resave

ljacqu added a commit that referenced this issue Aug 13, 2019
- Introduce PropertyValue to wrap the value to use for a property along with a validity flag referring to the state in the property resource (if false -> resave expected)
- Drop Property#isPresent in favor of the new valid flag on PropertyValue
- Remove explicit check for presence in migration service, using the data from the PropertyValue instances instead
ljacqu added a commit that referenced this issue Dec 26, 2019
…s during conversion processes

- Add ConvertErrorRecorder to signature of relevant methods
- Change the bean mapper to record recoverable errors via MappingContext
@ljacqu
Copy link
Member Author

ljacqu commented Dec 26, 2019

Breaking changes:

  1. Some of the methods now have ConversionErrorRecorder as an additional argument. Simply adding it to the methods and ignoring it will maintain the behavior before it was introduced. See class Javadoc for its usage.
  2. Bean properties may trigger a resave in a lot more cases than before: if any property is missing that is not an Optional, or some element in a map/collection had to be skipped, a rewrite of the resource will be triggered.
  3. Property#determineValue no longer returns the value but a PropertyValue (has value and flag to indicate whether it was really valid; read Javadoc on method)
  4. Property#isPresent no longer exists: use Property#isValidInResource (or Property#determineValue and check the flag). Note that the methods now define whether a value is present and whether it's a valid value (this was previously not 100% consistent)

@ljacqu ljacqu closed this as completed Jan 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant