Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
cowtowncoder opened this issue Nov 21, 2022 · 0 comments
Milestone

Comments

@cowtowncoder
Copy link
Member

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

@cowtowncoder cowtowncoder added to-evaluate Issue that has been received but not yet evaluated 2.15 and removed to-evaluate Issue that has been received but not yet evaluated labels Nov 21, 2022
@cowtowncoder cowtowncoder changed the title Allow use of @JsonCreator(mode = Mode.PROPERTIES) creator for POJOs for "empty String" coercion Allow use of @JsonCreator(mode = Mode.PROPERTIES) creator for POJOs with "empty String" coercion Nov 21, 2022
cowtowncoder added a commit that referenced this issue Nov 21, 2022
@cowtowncoder cowtowncoder added this to the 2.15.0 milestone Nov 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant