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

Add public JsonFactory factories to ObjectMappers #2586

Merged
merged 2 commits into from
Apr 5, 2023

Conversation

carterkozak
Copy link
Contributor

==COMMIT_MSG==
Add public JsonFactory factories to ObjectMappers
==COMMIT_MSG==

@changelog-app
Copy link

changelog-app bot commented Apr 5, 2023

Generate changelog in changelog/@unreleased

Type

  • Feature
  • Improvement
  • Fix
  • Break
  • Deprecation
  • Manual task
  • Migration

Description

Add public JsonFactory factories to ObjectMappers

Check the box to generate changelog(s)

  • Generate changelog entry

Comment on lines +243 to +247
private static <F extends JsonFactory, B extends TSFBuilder<F, B>> B withDefaults(B builder) {
return builder
// Interning introduces excessive contention https://github.com/FasterXML/jackson-core/issues/946
.disable(JsonFactory.Feature.INTERN_FIELD_NAMES);
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Unclear if we want this to be public like withDefaultModules(ObjectMapper)/etc. I opted to keep it private to push consumers toward concrete factories where we can add instrumentation.

Copy link
Contributor

Choose a reason for hiding this comment

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

Based on some other usages, making this public seems beneficial to consolidate functionality

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Let's revisit making this public later on since the string length metrics from our concrete factories are valuable to capture in the short term, and using withDefaults will bypass them.

Copy link
Contributor

@schlosna schlosna left a comment

Choose a reason for hiding this comment

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

Looks good, defer to you if/when you want to make withDefaults public for external consumption

Comment on lines +243 to +247
private static <F extends JsonFactory, B extends TSFBuilder<F, B>> B withDefaults(B builder) {
return builder
// Interning introduces excessive contention https://github.com/FasterXML/jackson-core/issues/946
.disable(JsonFactory.Feature.INTERN_FIELD_NAMES);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Based on some other usages, making this public seems beneficial to consolidate functionality

@bulldozer-bot bulldozer-bot bot merged commit 1229c48 into develop Apr 5, 2023
@bulldozer-bot bulldozer-bot bot deleted the ckozak/public_factory_methods branch April 5, 2023 18:05
@svc-autorelease
Copy link
Collaborator

Released 7.47.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants