users@jsonb-spec.java.net

[jsonb-spec users] [jsr367-experts] Re: Re: [1-RuntimeAPI] Proposal

From: Martin Grebac <martin.grebac_at_oracle.com>
Date: Fri, 06 Feb 2015 12:52:14 +0100

Hi Inderjeet,

On 05.02.15 18:33, Inderjeet Singh wrote:
> Some high-level points:
>
> 1. How about replacing Jsonb with Json everywhere in the API? Json is
> shorter and easier to understand. "b" doesn't necessarily make sense
> from a developer's perspective.
I actually ran through several different iterations before: 'Json',
'Jsonb', 'JsonBind', 'JsonBinding'. Though, I found 'JsonBind' and
'JsonBinding' unnecessarily long, and simple 'Json' clashes with JSON-P.
It is going to be a usual case to have JSON-P and JSON-B code to be
mixed together in the same class/method so it will cause a lot of confusion.

> 2. JsonBuilder.create() and newBuilder() methods seem unnecessary to me.
> new JsonBuilder() has much less conceptual weight as everyone
> understand what "new" does.
> 3. I think we should get rid of Providers. They don't add any value
> from a developer's perspective. If you really want it, add an SPI.
I think the 2 above are connected, though I'm not sure I'm able to
create the full picture. Would you share more details on this?

Thanks,
  MartiNG

> On Mon, Feb 2, 2015 at 8:50 AM, Martin Grebac
> <martin.grebac_at_oracle.com <mailto:martin.grebac_at_oracle.com>>wrote:
>
> On 02.02.15 8:37, Przemyslaw Bielicki wrote:
>
> Last comment on ServiceLoader. I'm not a big fan of it and it
> seems I'm not alone:
> http://stackoverflow.com/questions/7039467/java-serviceloader-with-multiple-classloaders.
> I already had many issues with it in production using JAX-WS.
> I had to extend a bit CXF provider with custom behavior, which
> was the easiest part. The problem appeared when I wanted my
> provider to be picked up by app server. If you have in you
> classpath more than one service provider it's the classloader
> who decides which one will be used - not you. And it might
> differ from one OS to another (e.g. because of case sensitive
> JAR paths). It was a big pain and when you use ServiceLoader
> you cannot really explicitly say which provider you want to
> use - which is a showstopper for me.
>
> In the proposal there's a call for provider(String providerName)
> with an explicit provider string. Would that solve the problem?
> MartiNG
>