Prefer to load custom property codec providers before default codec providers. #3038
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Like the PR title says - prefer to load user-defined custom property codec providers before the library default codec providers. This allows users to override default behavior to provide customizable codec logic for
Map
andCollection
types, as well as their subclasses.Added a test here to validate that the NoOp provider I added would load correctly, but I had to add it in a package separate from the existing tests to get access to the protected methods. Not sure if that's something I should avoid here, but generally it's considered good practice to have unit tests live in the same package as the source it's testing. I also had to add a
META-INF/services/MorphiaPropertyCodecProvider
file here to add the No-Op codec provider so that the service loader could access it. I tried monkeying around with ways to get it to load for only the test I wrote, but no avail.