public abstract class DependencyInjectionServiceLoader extends SimpleServiceLoader
Subclasses need to provide the implementation class name matching the requested services. The implementation is then
instantiated using Class.forName(String)
and Class.newInstance()
. The singletons are stored in a map.
services
Constructor and Description |
---|
DependencyInjectionServiceLoader() |
Modifier and Type | Method and Description |
---|---|
protected <T> T |
createAlternativeImplementation(Class<T> service)
Creates an implementation for the given service and save it in the cache.
|
protected abstract String |
getImplementationName(String serviceName)
Gets the implementation class name for the given service name.
|
checkServicePermission, getService, putService
@Nullable protected <T> T createAlternativeImplementation(Class<T> service)
SimpleServiceLoader
createAlternativeImplementation
in class SimpleServiceLoader
T
- the service type.service
- the service.null
.