-
- All Implemented Interfaces:
-
com.onesignal.common.services.IServiceProvider
public final class ServiceProvider implements IServiceProvider
A service provider gives access to the implementations of a service.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public classServiceProvider.Companion
-
Constructor Summary
Constructors Constructor Description ServiceProvider(List<ServiceRegistration<?>> registrations)
-
Method Summary
Modifier and Type Method Description <T extends Any> BooleanhasService(Class<T> c)Determine if the service provide has the provided service. <T extends Any> List<T>getAllServices(Class<T> c)Retrieve the list of services that are a T. <T extends Any> TgetService(Class<T> c)Retrieve the service that is a T. <T extends Any> TgetServiceOrNull(Class<T> c)Retrieve the service that is a T. -
-
Constructor Detail
-
ServiceProvider
ServiceProvider(List<ServiceRegistration<?>> registrations)
-
-
Method Detail
-
hasService
<T extends Any> Boolean hasService(Class<T> c)
Determine if the service provide has the provided service.
-
getAllServices
<T extends Any> List<T> getAllServices(Class<T> c)
Retrieve the list of services that are a T. If no service exists, an empty list will be returned.
- Parameters:
c- The class type of the services that are to be retrieved.
-
getService
<T extends Any> T getService(Class<T> c)
Retrieve the service that is a T. If multiple services exist, the last one registered will be returned. If no service exists, an exception will be thrown.
- Parameters:
c- The class type of the service that is to be retrieved.
-
-
-
-