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

Reply via email to