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

Infer @JsonCreator(mode = Mode.DELEGATING) from use of @JsonValue) #3654

Closed
cowtowncoder opened this issue Nov 7, 2022 · 0 comments
Closed
Labels
2.15 Issues planned for 2.15
Milestone

Comments

@cowtowncoder
Copy link
Member

cowtowncoder commented Nov 7, 2022

(note: continuation of [some issue but wrote originally down wrong])

Although @JsonValue is currently only used for serialization purposes, it seems it could be used for deciding on one otherwise ambiguous use case: that of 1-argument Creator method without mode property.
This case currently uses heuristics, such that:

  1. If there is explicit name specified for Creator argument (like @JsonProperty), Mode.PROPERTIES is used
  2. If there is a named non-creator-property matching Creator argument name, Mode.PROPERTIES is used -- this is typically the case for Record types
  3. Otherwise Mode.DELEGATING is used (unless different default choice specified)

However: use of @JsonValue would strongly suggest that as the second step (after explicit name for Creator argument) we should consider its existence to select Mode.DELEGATING instead.

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

No branches or pull requests

1 participant