-
-
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
Add a way to specify "inject-only" with @JacksonInject
#1381
Comments
This was referenced Nov 19, 2016
cowtowncoder
added a commit
that referenced
this issue
Apr 13, 2017
Note: for 2.x light-weight solution via #1565, but need to rewrite for 3.0 to do proper checking, if (and only if) we can keep track of actual declaration location. |
Has this been partially solved through FasterXML/jackson-annotations#120? |
Annotation issue can only add new properties but not actual handling (package only contains annotation declarations/definitions). |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Currently all injectable properties also allow binding of data from input, so if there is a JSON value for property, it will override anything injected. But this may not always be what user wants; sometimes it may be preferable to only use injection (and quietly drop value from data, if any). Or possible even reverse, that is, allowing injection to optional override value, but if no injectable value given to default to value from input data.
To support this change, some other changes are needed:
JacksonInject.Value
to contain aspects (name, precedence for now, possibly more in future)JacksonInject
to indicate if and how input data value is to be used.AnnotationIntrospector
to produce new value object but allow chaining with old implementations, to support some level of interoperabilityAs to enum to use (
JacksonInject.Input
?), perhaps:Primary
: (default) if input data has property, use that, not injected valueSecondary
: input data only used if no injected value can be foundNever
: input data never used, only injected valueAnother possible improvement could be to add another property (
required
?) to indicate whether it is acceptable to not have an injectable value defined, when one is needed (which is in all cases except withPrimary
, and finding actual data).If no value is found, and injection is NOT required (required would be the default for now)
null
would be injected.The text was updated successfully, but these errors were encountered: