You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@johnzon.apache.org by Romain Manni-Bucau <rm...@gmail.com> on 2016/05/10 18:19:21 UTC

ObjectConverter and root object

Hi guys,

we need to match a property to apply an object converter from what I saw.

Do we want to support to apply it on the root object (= no property
matching at all)

Means I can have {type: ..., instance: ...} and Foo {id, name} and still
call the converter.

I think we don't handle it yet cause we would need a wrapper on top of it
to match the first instance ({wrap: {type: ..., instance: ...}} is doable).

Did I miss anything?

Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> |  Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
<http://www.tomitribe.com> | JavaEE Factory
<https://javaeefactory-rmannibucau.rhcloud.com>

Re: ObjectConverter and root object

Posted by Romain Manni-Bucau <rm...@gmail.com>.
If you check JsonbType(De)Serializer you will see it is ANNOTATION_TYPE
supported ATM. Asked the EG why this and not TYPE (this last one means root
object is supported. Answer was: typo ;).

Feel free to take it if you want, I can't this end of week :(. However
super happy spec and us move the same way :).


Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> |  Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
<http://www.tomitribe.com> | JavaEE Factory
<https://javaeefactory-rmannibucau.rhcloud.com>

2016-05-11 9:44 GMT+02:00 Romain Manni-Bucau <rm...@gmail.com>:

>
> 2016-05-11 9:24 GMT+02:00 Mark Struberg <st...@yahoo.de.invalid>:
>
>> Yes the top level is always an 'object' currently. After all that is
>> JSON-B ;)
>>
>> It's a bit of a chicken-egg problem imo. The part which writes the object
>> brackets don't always know whether there will be an object or a sting on
>> the top layer.
>>
>>
> It knows since the writer is selected after the JsonNode is retrieved.
>
>
>>
>> We might need to review that if you think it's important to have this
>> feature.
>>
>
> *you* think it is important ;). That's the polymorphism case typically.
> Main issue we have is we would need a
> @Converter(CustomObjectConverter.class) on the class and not a field but I
> don't see any blocker.
>
>
>>
>> LieGrue,
>> strub
>>
>>
>>
>>
>>
>>
>> > On Tuesday, 10 May 2016, 20:19, Romain Manni-Bucau <
>> rmannibucau@gmail.com> wrote:
>> > > Hi guys,
>> >
>> > we need to match a property to apply an object converter from what I
>> saw.
>> >
>> > Do we want to support to apply it on the root object (= no property
>> > matching at all)
>> >
>> > Means I can have {type: ..., instance: ...} and Foo {id, name} and
>> > still
>> > call the converter.
>> >
>> > I think we don't handle it yet cause we would need a wrapper on top of
>> it
>> > to match the first instance ({wrap: {type: ..., instance: ...}} is
>> > doable).
>> >
>> > Did I miss anything?
>> >
>> > Romain Manni-Bucau
>> > @rmannibucau <https://twitter.com/rmannibucau> |  Blog
>> > <http://rmannibucau.wordpress.com> | Github
>> > <https://github.com/rmannibucau> |
>> > LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
>> > <http://www.tomitribe.com> | JavaEE Factory
>> > <https://javaeefactory-rmannibucau.rhcloud.com>
>> >
>>
>
>

Re: ObjectConverter and root object

Posted by Romain Manni-Bucau <rm...@gmail.com>.
2016-05-11 9:24 GMT+02:00 Mark Struberg <st...@yahoo.de.invalid>:

> Yes the top level is always an 'object' currently. After all that is
> JSON-B ;)
>
> It's a bit of a chicken-egg problem imo. The part which writes the object
> brackets don't always know whether there will be an object or a sting on
> the top layer.
>
>
It knows since the writer is selected after the JsonNode is retrieved.


>
> We might need to review that if you think it's important to have this
> feature.
>

*you* think it is important ;). That's the polymorphism case typically.
Main issue we have is we would need a
@Converter(CustomObjectConverter.class) on the class and not a field but I
don't see any blocker.


>
> LieGrue,
> strub
>
>
>
>
>
>
> > On Tuesday, 10 May 2016, 20:19, Romain Manni-Bucau <
> rmannibucau@gmail.com> wrote:
> > > Hi guys,
> >
> > we need to match a property to apply an object converter from what I saw.
> >
> > Do we want to support to apply it on the root object (= no property
> > matching at all)
> >
> > Means I can have {type: ..., instance: ...} and Foo {id, name} and
> > still
> > call the converter.
> >
> > I think we don't handle it yet cause we would need a wrapper on top of it
> > to match the first instance ({wrap: {type: ..., instance: ...}} is
> > doable).
> >
> > Did I miss anything?
> >
> > Romain Manni-Bucau
> > @rmannibucau <https://twitter.com/rmannibucau> |  Blog
> > <http://rmannibucau.wordpress.com> | Github
> > <https://github.com/rmannibucau> |
> > LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
> > <http://www.tomitribe.com> | JavaEE Factory
> > <https://javaeefactory-rmannibucau.rhcloud.com>
> >
>

Re: ObjectConverter and root object

Posted by Mark Struberg <st...@yahoo.de.INVALID>.
Yes the top level is always an 'object' currently. After all that is JSON-B ;)

It's a bit of a chicken-egg problem imo. The part which writes the object brackets don't always know whether there will be an object or a sting on the top layer. 


We might need to review that if you think it's important to have this feature.

LieGrue,
strub






> On Tuesday, 10 May 2016, 20:19, Romain Manni-Bucau <rm...@gmail.com> wrote:
> > Hi guys,
> 
> we need to match a property to apply an object converter from what I saw.
> 
> Do we want to support to apply it on the root object (= no property
> matching at all)
> 
> Means I can have {type: ..., instance: ...} and Foo {id, name} and 
> still
> call the converter.
> 
> I think we don't handle it yet cause we would need a wrapper on top of it
> to match the first instance ({wrap: {type: ..., instance: ...}} is 
> doable).
> 
> Did I miss anything?
> 
> Romain Manni-Bucau
> @rmannibucau <https://twitter.com/rmannibucau> |  Blog
> <http://rmannibucau.wordpress.com> | Github 
> <https://github.com/rmannibucau> |
> LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
> <http://www.tomitribe.com> | JavaEE Factory
> <https://javaeefactory-rmannibucau.rhcloud.com>
>