@Deprecated public final class DefaultServiceLocator extends Object implements org.eclipse.aether.spi.locator.ServiceLocator
RepositorySystem repoSystem = serviceLocator.getService( RepositorySystem.class );Note: This class is not thread-safe. Clients are expected to create the service locator and the repository system on a single thread.
Modifier and Type | Class and Description |
---|---|
static class |
DefaultServiceLocator.ErrorHandler
Deprecated.
A hook to customize the handling of errors encountered while locating a service implementation.
|
Constructor and Description |
---|
DefaultServiceLocator()
Deprecated.
Creates a new service locator that already knows about all service implementations included this library.
|
Modifier and Type | Method and Description |
---|---|
<T> DefaultServiceLocator |
addService(Class<T> type,
Class<? extends T> impl)
Deprecated.
Adds an implementation class for a service.
|
<T> T |
getService(Class<T> type)
Deprecated.
|
<T> List<T> |
getServices(Class<T> type)
Deprecated.
|
void |
setErrorHandler(DefaultServiceLocator.ErrorHandler errorHandler)
Deprecated.
Sets the error handler to use.
|
<T> DefaultServiceLocator |
setService(Class<T> type,
Class<? extends T> impl)
Deprecated.
Sets the implementation class for a service.
|
<T> DefaultServiceLocator |
setServices(Class<T> type,
T... services)
Deprecated.
Sets the instances for a service.
|
public DefaultServiceLocator()
public <T> DefaultServiceLocator setService(Class<T> type, Class<? extends T> impl)
Service
to gain access to this service locator.T
- The service type.type
- The interface describing the service, must not be null
.impl
- The implementation class of the service, must not be null
.null
.public <T> DefaultServiceLocator addService(Class<T> type, Class<? extends T> impl)
Service
to gain access to this service locator.T
- The service type.type
- The interface describing the service, must not be null
.impl
- The implementation class of the service, must not be null
.null
.public <T> DefaultServiceLocator setServices(Class<T> type, T... services)
T
- The service type.type
- The interface describing the service, must not be null
.services
- The instances of the service, may be null
but must not contain null
elements.null
.public <T> T getService(Class<T> type)
getService
in interface org.eclipse.aether.spi.locator.ServiceLocator
public <T> List<T> getServices(Class<T> type)
getServices
in interface org.eclipse.aether.spi.locator.ServiceLocator
public void setErrorHandler(DefaultServiceLocator.ErrorHandler errorHandler)
errorHandler
- The error handler to use, may be null
to ignore/swallow errors.Copyright © 2010–2022 The Apache Software Foundation. All rights reserved.