-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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 @JsonAnySetter
on Creators
#4558
Conversation
…r can just pour into the any-setter
@JsonAnySetter
on Creators
Excellent progress! Hoping to review this in detail (had a quick look, much improved from what I already saw -- and not just wrt addressing things I mentioned but overall) |
FWTW, this is part of one of two listed "major design/implementation issues" page: https://github.com/FasterXML/jackson-future-ideas/wiki/Major-Design---Implementation-Issues so not "just" one of top-voted Mostly Wanted features but also considered a significant design/implementation concern. |
if (name == null) { | ||
boolean isAnySetter = Boolean.TRUE.equals(ctxt.getAnnotationIntrospector().hasAnySetter(param)); | ||
if (isAnySetter) { | ||
if (anySetterFound) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like we lose information on any-setter, and only call introspector to find multiples here... but then need to re-introspect later on?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I remembered now, this code serves two purposes.
- One is to detect and handle multiple any-setter (which, as you said, could be moved to later one below)
- The other one, which I do need help with is... not any-setter not having any property name here. So any-setter creator parameter without any name specified (via
@JsonProperty
) throws error.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LMK if you have better idea with the second problem I am facing, @cowtowncoder
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah. Yes. For that purpose, we could only do a lookup if name
not found. Let me think about this a bit, good point, something is needed here.
src/main/java/com/fasterxml/jackson/databind/deser/BeanDeserializerFactory.java
Show resolved
Hide resolved
src/main/java/com/fasterxml/jackson/databind/deser/SettableAnyProperty.java
Outdated
Show resolved
Hide resolved
src/main/java/com/fasterxml/jackson/databind/deser/SettableAnyProperty.java
Outdated
Show resolved
Hide resolved
src/main/java/com/fasterxml/jackson/databind/deser/impl/PropertyValueBuffer.java
Outdated
Show resolved
Hide resolved
src/main/java/com/fasterxml/jackson/databind/deser/impl/PropertyValueBuffer.java
Outdated
Show resolved
Hide resolved
src/main/java/com/fasterxml/jackson/databind/deser/impl/PropertyValueBuffer.java
Outdated
Show resolved
Hide resolved
src/main/java/com/fasterxml/jackson/databind/deser/BeanDeserializer.java
Show resolved
Hide resolved
…cks for Field vs Ctor Parameter)
…t null/missing checks)
src/test/java/com/fasterxml/jackson/databind/deser/creators/AnySetterForCreator562Test.java
Show resolved
Hide resolved
src/test/java/com/fasterxml/jackson/databind/deser/creators/AnySetterForCreator562Test.java
Show resolved
Hide resolved
Phew, that was alot of work 😆 Hopefully, it won't be too hard merging into master. |
@JooHyukKim thank you for actually implementing it & going through all tiny things I wanted changed :) Surprisingly merge to master was quite straight-forward this time around. And with this, we are getting somewhat close to 2.18.0 minimum feature set, as far as I care. |
resolves #562
This version is more adherent to existing call flow and simply extends existing implementations, such as....
SettableAnyProperty
subclassesJsonNodeParameterAnyProperty
andMapParameterAnyProperty
SettableAnyProperty
methodsgetParameterIndex()
createParameterObject()
to streamline deserialization byPropertyValueBuffer
Also suggestions from PR #4366 have been followed
JsonNode
andObjectNode