Skip to content

Allow use of @JsonCreator(mode = Mode.PROPERTIES) creator for POJOs with "empty String" coercion #3676

Closed
@cowtowncoder

Description

@cowtowncoder

(note: offshoot of FasterXML/jackson-dataformat-xml#547)

Currently it is possible to allow coercion from JSON Empty String into POJOs that have "default" (aka "no-arg" or "0-arg") Creator (constructor of rfactory method). But it is not possible to use "properties"-style Creator like:

class Pojo {
   protected int a, b;

   @JsonCreator(mode = Mode.PROPERTIES)
   public Pojo(@JsonProperty("a") int a, @JsonProperty("b") int b) {
      this.a = a;
      this.b = b;
   }
}

as deserialization only wants to use default creator.

But we could actually use Properties-passing one (if one exists). Let's allow this.

NOTE: this is most useful for XML use case.

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