You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Allow @JsonAnySetter to flow through Creators #562
@JsonCreator
public MyClass(@JsonProperty("a") String a, @JsonAnySetter Map<String, Object> leftovers) {}
Reacted by Thibaud Lepretre, Isaac Whitfield, Giuseppe La Tona, Dan Sanduleac, Volodymyr Barna, Willi Schönborn, Nikolay Martynov, Basil Peace, Ben, David García and 35 more
@huhlig It would be nice to get it there, but I can not predict whether it will or not. I do think it would be great to get it to work but there are so many things to work on...
I will keep this in mind as one of "more/most wanted" issues.
Reacted by aleksey-te, Eric Sirianni, Adrian Baker, philippendrulat, Jen, Cenk Akin, Stephen Connolly, Simon Dean, Peter Dahlberg, Michael Wellner and 3 more
I'd also like to see this feature. As a workaround for the immutability enthusiasts, here's an example of using JsonAnySetter in an immutable class (swap out the Map/HashMap for an immutable equivalent as you like). The trick is that the JsonAnySetter method can be made private.
Activity
whiskeysierra commentedon Jul 8, 2015
👍 Is this something that you already considered putting in?
cowtowncoder commentedon Jul 8, 2015
Considered, yes, had time to try to tackle, no. Would definitely be nice thing to support.
huhlig commentedon Dec 3, 2018
Any likelihood this will land in 3.x?
davide-imbriaco commentedon Jan 28, 2019
Hi,
I would also really like this (allows for immutable beans, and validation of data in constructor method).
cowtowncoder commentedon Feb 5, 2019
@huhlig It would be nice to get it there, but I can not predict whether it will or not. I do think it would be great to get it to work but there are so many things to work on...
I will keep this in mind as one of "more/most wanted" issues.
davidmoten commentedon May 12, 2023
I'd also like to see this feature. As a workaround for the immutability enthusiasts, here's an example of using JsonAnySetter in an immutable class (swap out the Map/HashMap for an immutable equivalent as you like). The trick is that the JsonAnySetter method can be made private.
cowtowncoder commentedon Jan 27, 2024
@JooHyukKim I think we could use a "failing" test case for this, as pre-cursor to #3439.
Note, too, that this is definitely one of Most-Wanted issues open.
Add failing test (reproduction) for #562
Add failing test (reproduction) for #562 (#4347)
cowtowncoder commentedon Jan 28, 2024
Added a failing test, as a minor help for anyone considering to try to implement.
Also, made
@JsonAnySetterapplicable to (constructor) parameters injackson-annotations2.17 (was not previously).JooHyukKim commentedon Jan 28, 2024
This is great. Thank you for taking care of things in advance.
cowtowncoder commentedon Jan 28, 2024
Np. Needed that already for reproduction :)
cowtowncoder commentedon Jun 1, 2024
Quick note: really hoping to get this resolved for 2.18 -- and I think there's a good chance this can happen.
[-]Allow 'JsonAnySetter' to flow through JsonCreator.[/-][+]Allow `@JsonAnySetter` to flow through Creators[/+]cowtowncoder commentedon Jun 9, 2024
Thanks to PR by @JooHyukKim this is now FINALLY implemented, merged for inclusion in 2.18.0!!!
Nick-Minutello commentedon Aug 30, 2024
Excellent. When is 2.18.0 expected to be released ?
JooHyukKim commentedon Aug 30, 2024
@Nick-Minutello This week. Please refer to https://groups.google.com/u/2/g/jackson-dev/c/6JaMbhEFwtY
Add any-setter handling in `PropertyValueBuffer` post #562 (#4720)