Default mode to use (properties-based vs delegating creator) uses
heuristics, to try to figure out most likely intent,
in cases of single-argument creator (constructor or factory method,
annotated with `@JsonCreator`, but without:
1. `mode` property to determine which type to choose and
2. without explicit name for the one argument
if, so, heuristics is simply to try to see if there is an otherwise
detected property (inferred from field, setter and/or getter),
with name that matches implicit name of the argument. If so,
property-based creator approach is used.
Otherwise delegating.
So, for example:
public class BeanProps {
public int value;
@JsonCreator
public BeanProps(int value) {
this.value = value;
}
}
would be detected as properties-based if (and only if) something can
give the implicit name of constructor argument --
this means usually use of `jackson-module-parameter-names` (or
possibly paranamer module).
There are also some cases that might appear like use of default
logics, such as case of no `@JsonCreator` but
explicit name for parameter, but which are explicit resolved (in that
case, always as properties-based); or,
implicit single-argument constructor with String/int/long/boolean
argument, with no `@JsonCreator` or explicit
name (that case is always delegating).
In practice, I think the most common case of ambiguity and mismatch is
that of a single string argument. That can
very easily be used for either purpose (deserialize from String OR
match to the one property POJO has).
There is no way to change the default behavior, although I am thinking
that use of heuristics is quite fragile and in
many ways it would be better to perhaps not allow ambiguity at all.
The problem is, I think, that some users would really
really want to avoid any use of annotations, which is fundamentally
incompatible with the goal of no-surprises-always-explicit
requirement.
Does this help understand the logic?
-+ Tatu +-