Add JsonInclude.Value convenience constants#314
Merged
Conversation
Equivalent to the enum values of JsonInclude.Include. See also discussion here: FasterXML/jackson-databind#5294
cowtowncoder
reviewed
Sep 5, 2025
cowtowncoder
reviewed
Sep 5, 2025
Member
|
I think it's ok to just expose these particular constants without accessor. One process thing: I'd need CLA: https://github.com/FasterXML/jackson/blob/main/contributor-agreement.pdf (unless you have sent one in the past, if so, LMK). The usual way is to print, fill & sign, scan/photo, email to |
The constants specify the same JsonInclude.Include for inclusion of values both on Java object level, as well when contained in an object reference (e.g. an AtomicReference).
Member
|
NOTE: CLA received. |
When referring to the instances of JsonInclude.Value, to avoid too much overloading with "values" referring to values being serialized to JSON. See also discussion: FasterXML#314 (comment)
JsonInclude.Value convenience constants
cowtowncoder
reviewed
Sep 9, 2025
| * This will specify the same setting for including a value both | ||
| * on <b>Java object level</b> as well as when <b>contained</b> | ||
| * in an object reference (see {@link JsonInclude} for further | ||
| * details on this distinction). |
Member
There was a problem hiding this comment.
Actually makes sense & looks good. Thank you for doing this.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
See discussion here: FasterXML/jackson-databind#5294
This pull-request adds some constants to
JsonInclude.Valueequivalent to the enum values ofJsonInclude.Include.This e.g enables the following for configuring a JsonMapper:
I noticed a kind of established pattern in
JsonInclude.Valueto declarestatic finalconstants asprotected, and use a static method to access it. If this pattern is also applicable for these constants, just let me know, and I will edit the pull-request accordingly!