Re[2]: Why service provider method is called "provider", but not "provide"?

Alex Orlov ooo_saturn7 at mail.ru
Tue Nov 24 06:46:09 UTC 2020


Could you then explain the difference between service and service provider? As I understand
you’re saying they are the same. I always thought, that they were two different things. For example,
what we are talking about service factory/supplier/consumer we separate service from
factory/supplier/consumer. And even in
https://docs.oracle.com/javase/9/docs/api/java/util/ServiceLoader.Provider.html
we assume that this is a provider, and using this provider you can get a service.
 
 
--
Best regards, Alex Orlov
 
  
>Вторник, 24 ноября 2020, 7:47 +03:00 от David Holmes <david.holmes at oracle.com>:
> 
>On 23/11/2020 6:28 pm, Alex Orlov wrote:
>> > 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.
>> I don’t agree with that. It returns the object that is an instance of
>> the service.
>
>And that object is the service provider.
>
>David
>-----
>
>> --
>> Best regards, Alex Orlov
>>
>> Понедельник, 23 ноября 2020, 1:30 +03:00 от David Holmes
>> < david.holmes at oracle.com >:
>> 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
>> < 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