On Tue, Dec 13, 2016 at 8:41 AM, Lev Kuznetsov
<lev.v.kuznet...@gmail.com> wrote:
> Instinctively I'd like to avoid having the @JsonGetter method at all as I
> feel the @JsonTypeInfo should do everything for me, afterall it does on the
> deserialization. I'm fine with including it as As.EXISTING_PROPERTY since it
> produces the correct output and input but I feel this is a workaround.

Just to make sure: you absolutely do not need such POJO property;
Jackson does not need it.
Since `type` is piece of metadata it does exist in json but isn't (by
default) assumed to be needed as payload data.

So if you don't need it, just drop the getter; value should be written
by default as type id.

Use of EXISTING_PROPERTY was added to allow alternatively to consider
type id as both metadata and real data; it is bit unwieldy -- ideally
it would just auto-detect -- but for now the only reliable way.
Perhaps in future we can improve this to have smoother handling.

I hope this helps!

-+ 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+unsubscr...@googlegroups.com.
> To post to this group, send email to jackson-user@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to jackson-user@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to