You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@juneau.apache.org by James Bognar <ja...@salesforce.com> on 2017/06/04 13:16:28 UTC

Combined serializers and parsers.

Wacky idea here...and something that would have to wait for a major release
(e.g. 7?)

Combine the serializers and parsers together into the same class.

Current....
Bean b;
String json = JsonSerializer.DEFAULT.serialize(b);
b = JsonParser.DEFAULT.parse(json);

Better?....
Bean b;
String json = Json.DEFAULT.serialize(b);
b = Json.DEFAULT.parse(json);

Builders would also be combined.

-- 
James Bognar

Re: Combined serializers and parsers.

Posted by "John D. Ament" <jo...@apache.org>.
Correct, I was thinking along the lines of a facade.  Its not a bad idea to
combine them, but most libraries out there keep them separate.  but that
could easily be the differentiator with Juneau.

On Sun, Jun 4, 2017 at 9:26 AM James Bognar <ja...@salesforce.com>
wrote:

> I was thinking it would replace the existing classes.  That's why it would
> require a major release.  If the old classes remained, it would essentially
> require duplicating the code.
>
> But I think what you're implying is if we could create a Json 'facade' on
> top of the exising JsonSerializer/JsonParser classes?  That's an
> interesting idea.
>
> (FYI....I'm just throwing this idea out there...it literally just popped in
> my head this morning).
>
>
>
> On Sun, Jun 4, 2017 at 9:20 AM, John D. Ament <jo...@apache.org>
> wrote:
>
> > You wouldn't have to drop the existing ones to do this right? They could
> > stay in place and yet still have the new combined version.
> >
> > On Sun, Jun 4, 2017 at 9:16 AM James Bognar <james.bognar@salesforce.com
> >
> > wrote:
> >
> > > Wacky idea here...and something that would have to wait for a major
> > release
> > > (e.g. 7?)
> > >
> > > Combine the serializers and parsers together into the same class.
> > >
> > > Current....
> > > Bean b;
> > > String json = JsonSerializer.DEFAULT.serialize(b);
> > > b = JsonParser.DEFAULT.parse(json);
> > >
> > > Better?....
> > > Bean b;
> > > String json = Json.DEFAULT.serialize(b);
> > > b = Json.DEFAULT.parse(json);
> > >
> > > Builders would also be combined.
> > >
> > > --
> > > James Bognar
> > >
> >
>
>
>
> --
> James Bognar
>

Re: Combined serializers and parsers.

Posted by James Bognar <ja...@salesforce.com>.
I was thinking it would replace the existing classes.  That's why it would
require a major release.  If the old classes remained, it would essentially
require duplicating the code.

But I think what you're implying is if we could create a Json 'facade' on
top of the exising JsonSerializer/JsonParser classes?  That's an
interesting idea.

(FYI....I'm just throwing this idea out there...it literally just popped in
my head this morning).



On Sun, Jun 4, 2017 at 9:20 AM, John D. Ament <jo...@apache.org> wrote:

> You wouldn't have to drop the existing ones to do this right? They could
> stay in place and yet still have the new combined version.
>
> On Sun, Jun 4, 2017 at 9:16 AM James Bognar <ja...@salesforce.com>
> wrote:
>
> > Wacky idea here...and something that would have to wait for a major
> release
> > (e.g. 7?)
> >
> > Combine the serializers and parsers together into the same class.
> >
> > Current....
> > Bean b;
> > String json = JsonSerializer.DEFAULT.serialize(b);
> > b = JsonParser.DEFAULT.parse(json);
> >
> > Better?....
> > Bean b;
> > String json = Json.DEFAULT.serialize(b);
> > b = Json.DEFAULT.parse(json);
> >
> > Builders would also be combined.
> >
> > --
> > James Bognar
> >
>



-- 
James Bognar

Re: Combined serializers and parsers.

Posted by "John D. Ament" <jo...@apache.org>.
You wouldn't have to drop the existing ones to do this right? They could
stay in place and yet still have the new combined version.

On Sun, Jun 4, 2017 at 9:16 AM James Bognar <ja...@salesforce.com>
wrote:

> Wacky idea here...and something that would have to wait for a major release
> (e.g. 7?)
>
> Combine the serializers and parsers together into the same class.
>
> Current....
> Bean b;
> String json = JsonSerializer.DEFAULT.serialize(b);
> b = JsonParser.DEFAULT.parse(json);
>
> Better?....
> Bean b;
> String json = Json.DEFAULT.serialize(b);
> b = Json.DEFAULT.parse(json);
>
> Builders would also be combined.
>
> --
> James Bognar
>