Why service provider method is called "provider", but not "provide"?
David Holmes
david.holmes at oracle.com
Sun Nov 22 22:30:16 UTC 2020
On 20/11/2020 9:48 pm, Alex Orlov wrote:
>
> Hello all,
>
> According to this tutorial https://www.logicbig.com/tutorials/core-java-tutorial/modules/service-provider-method.html
> we can declare in module-info provider class with "provider" method. For example,
>
> ......
> public class TheServiceProvider {
> public static AService provider() {
> return new AServiceImpl();
> }
> }
>
> The only thing what I don’t understand is why this method is called "provider". The method doesn’t return
> provider, method returns an instance of the service, so, as I understand, the method must be named
> "provide". And, as I understand, provider is usually the class, that has "provide" method.
The method does return a "provider". It returns the object that is an
instance of a class that provides the service - hence that object is a
provider.
Cheers,
David
-----
> Of course that’s not very important, but it is JDK, so it was developed by very experienced java developer
> who should know java naming convention and I want to understand why this did so. Could anyone explain?
>
>
> --
> Best regards, Alex Orlov
>
More information about the jigsaw-dev
mailing list