public abstract class SimpleServiceLoader extends Object implements ServiceLoader
| Modifier and Type | Field and Description | 
|---|---|
| protected PackedMap<Class<?>,Object> | servicesThe cache of instantiated services. | 
| Constructor and Description | 
|---|
| SimpleServiceLoader()Instantiates a new default service loader. | 
| Modifier and Type | Method and Description | 
|---|---|
| protected <T> void | checkServicePermission(Class<T> service,
                      String action)Checks that an action on a service is permitted. | 
| protected <T> T | createAlternativeImplementation(Class<T> service)Creates an implementation for the given service and save it in the cache. | 
| <T> T | getService(Class<T> service)Gets the instance of the given service. | 
| protected <T> void | putService(Class<T> service,
          T instance)Put a service in the services map in a synchronized context. | 
protected final PackedMap<Class<?>,Object> services
Be careful to use it in a synchronized context.
putService(Class, Object)public SimpleServiceLoader()
protected <T> void checkServicePermission(Class<T> service, String action)
T - the service type.service - the service.action - the action.@Nullable protected <T> T createAlternativeImplementation(Class<T> service) throws ServiceLoadingException
T - the service type.service - the service.null.ServiceLoadingException - if an error occurs while instantiating the service instance.@Nullable public <T> T getService(Class<T> service)
ServiceLoaderIf there is already an instance in cache, it is returned otherwise a new one is created.
 May return null if the service is not defined.
getService in interface ServiceLoaderT - the service type.service - the service.protected <T> void putService(Class<T> service, T instance)
T - the service type.service - the service.instance - the service instance.