Package org.ehcache.spi.service
Interface ServiceProvider<T extends Service>
- Type Parameters:
T- The type of services this provider returns
public interface ServiceProvider<T extends Service>
A repository of
Service instances that can be used to look them up by type.-
Method Summary
Modifier and TypeMethodDescription<U extends T>
UgetService(Class<U> serviceType) Looks up theServiceof the givenserviceType.<U extends T>
Collection<U>getServicesOfType(Class<U> serviceType) Looks up allServiceinstances that are subtypes of the givenserviceTypesupplied.
-
Method Details
-
getService
Looks up theServiceof the givenserviceType.There is no guarantee that services returned here will be started.
- Type Parameters:
U- theServicetype- Parameters:
serviceType- theclassof the service being looked up- Returns:
- a service instance of type
T, ornullif it couldn't be located - Throws:
IllegalArgumentException- ifserviceTypeis marked with thePluralServiceannotation- See Also:
-
getServicesOfType
Looks up allServiceinstances that are subtypes of the givenserviceTypesupplied.This method must be used to retrieves service types marked with the
PluralServiceannotation.- Type Parameters:
U- theServicetype- Parameters:
serviceType- theclassof the service being looked up- Returns:
- all the service instances assignable to
serviceType
-