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

Introduce ConversionContext and clean up MappingMongoConverter #3575

Closed
wants to merge 7 commits into from

Conversation

mp911de
Copy link
Member

@mp911de mp911de commented Mar 1, 2021

ConversionContext serves as entrpoint for recursive (read) conversion of documents, lists, maps, and simple values. The actual decision which converter strategy to apply is now encapsulated by ConversionContext.convert(…) which removes strategy duplications from the actual conversion methods.

Also, converter methods for documents, maps, lists, … are now protected for easier customization by subclasses.

Closes #3571

Move static methods around. Revisit nullability annotations. Extract conversion service call into own method.
Reintroduce deprecated API. Make conversion entrypoint methods protected so that they can be overridden.

Tweak Javadoc.
* @param key must not be {@literal null}.
* @param value can be {@literal null}.
* @return {@literal true} if (key/value pair) is present.
* @since 2.5
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be @since 3.2

* Remove {@code _id : null} from the given {@link Bson} if present.
*
* @param bson must not be {@literal null}.
* @since 2.5
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be @since 3.2

christophstrobl pushed a commit that referenced this pull request Mar 3, 2021
Introduce a ConversionContext used during the mapping process to carry forward required information.
ConversionContext serves as entrpoint for recursive (read) conversion of documents, lists, maps, and simple values. The actual decision which converter strategy to apply is now encapsulated by ConversionContext.convert(…) which removes strategy duplications from the actual conversion methods.

Also, converter methods for documents, maps, lists, … are now protected for easier customization by subclasses.

Closes #3571
Original Pull Request: #3575
christophstrobl added a commit that referenced this pull request Mar 3, 2021
Also remove MapUtils and blend new methods into the existing BsonUtils.

Original Pull Request: #3575
@christophstrobl christophstrobl deleted the issue/3571 branch March 3, 2021 10:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: waiting-for-triage An issue we've not yet triaged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Introduce ConversionContext and clean up MappingMongoConverter
3 participants