Skip to content

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

@cowtowncoder

Description

@cowtowncoder

(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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions