On Thu, Jan 12, 2017 at 2:49 AM, <
victo...@gmail.com> wrote:
> The only thing that successfully worked is to have a parameter-less
> constructor and let Jackson set the fields (I didn't use a setter but simply
> let jackson access the private field via reflection I guess).
>
> I thought it should at least worked with the first case (i.e. if there is a
> constructor for the object, then Jackson should not try to set
> @JsonUnwrapped fields). I will open an issue for that then.
Yes but do note that as far as databind is concerned there is no
relationship between "unwrapped" property with logical name of
'location' (but not used for anything), and then separate properties
'latitude' and 'longitude' passed to creator. This because contents of
unwrapped POJO can not be inserted at this point -- this is an
implementation limitation and not hard limit, of course, but
nonetheless current active limit.
In a way it could work if there was a way to indicate that
`@JSonUnwrapped` only relates to serialization, that is, ignored for
deserialization.
Or, eventually, if and when unwrapped-handling is rewritten (it really
ought to: only limit is time and interested), this could be fixed
properly.
> The second case, even though you said should work (I think that's what you
> meant by "not trying to handle `latitude`
> and `longitude`, and instead have a setter for location."), does not as I
> explained… not sure if it is so easy for Jackson to partially build an
> object using a @JsonCreator constructor… I will make note of that in the
> issue I create.
Right: I can see why it does not work currently, but it seems that
this particular case could be made to work without user-side changes.
But no such improvement has been made yet.
>
> Of course not using @JsonUnwrapped is not an option here :)
>
> Thanks for your help in any case!
Likewise!
-+ Tatu +-
> --
> You received this message because you are subscribed to the Google Groups
> "jackson-user" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to
jackson-user...@googlegroups.com.
> To post to this group, send email to
jackso...@googlegroups.com.
> For more options, visit
https://groups.google.com/d/optout.