Infer @JsonCreator(mode = Mode.DELEGATING)
from use of @JsonValue
) · Issue #3654 · FasterXML/jackson-databind (original) (raw)
(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:
- If there is explicit name specified for Creator argument (like
@JsonProperty
),Mode.PROPERTIES
is used - If there is a named non-creator-property matching Creator argument name,
Mode.PROPERTIES
is used -- this is typically the case for Record types - 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.