Hi Dmitry
Think the topic is not polymorphism but advanced adapter. Polymorphism is
one example of that only.
The last proposal of Roman needs some rework - see my last mail with
JsonbObjectBuilder - but we move forward and in the right direction: making
easy from/to map to jsonp objects - including objects directly and not
primitives only - is what makes sense and gives us all the flexibility.
Makes a bit harder to implement trivial cases but here it is easy to add to
the spec an abstrat class skipping jsonp (for object to primitive mapping
if we judge it too verbose using a JsonValue bit I think it can be optional
for jsonb 1.0)
I am really for fixing adapter API and not making polymorphism a particular
case of the spec.
Le 31 mars 2016 23:46, "Dmitry Kornilov" <dmitry.kornilov_at_oracle.com> a
écrit :
> Hi,
>
> I see that polymorphism discussion is still on. I am planning to publish a
> second draft soon so we need to make a decision rather sooner than later.
>
> I see that we have three options:
>
> 1. We don’t support polymorphism in this version of the spec. We still can
> add it later.
>
> 2. We add PolymorphicAdapter suggested by Roman to the spec.
>
> 3. We create a special annotation @JsonbPolymorphism (or other name) which
> will enable polymorphic handling of the annotated type. It can accept a
> list of supported children as a parameter. Empty list means all children.
>
> Sample:
>
> public class Foo {
>
> @JsonbPolymorphism
> Animal animal;
> }
>
> For me the third option looks the most reasonable one. What do you think?
>
> Thanks,
> Dmitry