JPMS providers naming convention

Alex Buckley alex.buckley at oracle.com
Fri Dec 1 19:50:38 UTC 2023


Foo for the service, FooProvider for the service provider.

I don't see why clients should have to spell out FooService rather than 
Foo in the many places where they refer to (the type of) the service.

As for implementations of the Foo service, the javadoc for ServiceLoader 
says: "A _service provider_ (or just _provider_) is a class that ..." -- 
suggesting that FooProvider is just as good as FooServiceProvider.

Even better is to avoid "Provider" altogether. Use which ever name best 
describes this particular implementation of Foo, and don't distort the 
names just because objects will be created via `ServiceLoader` rather 
than via `new`. Note that the example in the javadoc doesn't use 
"Service" or "Provider" in any names.

Alex

On 12/1/2023 12:31 AM, Alex Orlov wrote:
> Hi all,
> Lets suppose that I have FooService interface and I want to make JPMS 
> provider for it (provides FooService with ...). Could anyone say ow I 
> should name my provider: FooServiceProvider or FooProvider?
> --
> Best regards, Alex Orlov


More information about the jigsaw-dev mailing list