jackson-module-parameter-names
jackson-module-parameter-names copied to clipboard
Mode.PROPERTIES still does not support single argument constructor.
I have a simple class:
public A {
private final String title;
public A(String title) {
this.title = title;
}
}
When I serialize this (with private field visibility) I get:
{
"title" : "Alice in Wonderland",
}
When deserializing (with new ParameterNamesModule(Mode.PROPERTIES)
) I however get this exception:
com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot construct instance of A
(although at least one Creator exists): cannot deserialize from Object value (no delegate- or property-based Creator)
What is ambigious here? There is a creator, but it refuses to use it, even though the properties are matches for the parameter names.
If I add a @JsonProperty annotation or a 2nd parameter, the ambiguity disappears. Is it really impossible to tell Jackson to never ever attempt deserializing by passing in a piece of JSON string text? I never want it to use Mode.DELEGATING...