public interface ScopeConfiguration
Modifier and Type | Method and Description |
---|---|
ScopeConfiguration |
add(Class<?> service)
Add the specified type as a service provider in this scope
|
default ScopeConfiguration |
add(Class<?> type,
Object impl)
Add an instance of the specified service
|
default ScopeConfiguration |
add(Iterable<Class<?>> services)
Add the specified types as service providers in this scope
|
ScopeConfiguration |
add(TypeQualifier<?> provides,
Object impl)
Add an instance of the specified service
|
ScopeConfiguration |
ignore(Class<?> type)
Ensure that all providers of the specified service type are ignored in this scope.
|
default ScopeConfiguration |
named(Map<String,Object> namedAttributes)
Add the specified object instances, each of which will be constrained with a
Named constraint. |
ScopeConfiguration |
onClose(Runnable onClose)
Configure a task to be run when this scope is closed.
|
default ScopeConfiguration |
set(Class<?> provides,
Object impl)
Set the sole implementation of the specified service to be the specified instance.
|
ScopeConfiguration |
set(TypeQualifier<?> provides,
Object impl)
Set the sole implementation of the specified service to be the specified instance.
|
ScopeConfiguration add(Class<?> service)
service
- The service provider typedefault ScopeConfiguration add(Iterable<Class<?>> services)
services
- Set of service provider typesdefault ScopeConfiguration add(Class<?> type, Object impl)
type
- The type of the service providedimpl
- The instance of the serviceScopeConfiguration add(TypeQualifier<?> provides, Object impl)
provides
- The qualified service that the instance providesimpl
- The instance of the serviceScopeConfiguration ignore(Class<?> type)
type
- The type of the service to ignoredefault ScopeConfiguration named(Map<String,Object> namedAttributes)
Named
constraint. Each attribute will be
bound to offer it's own type (the value returned by getClass()
) as the service that it offers.namedAttributes
- Map
of String keys to Object
instances. The key will be bound to a Named
TypeQualifier
, whose type will be the value returned by the objects's Object.getClass()
methodScopeConfiguration onClose(Runnable onClose)
onClose
- The task to perform when the scope is closeddefault ScopeConfiguration set(Class<?> provides, Object impl)
provides
- The service being providedimpl
- The instance that provides the serviceScopeConfiguration set(TypeQualifier<?> provides, Object impl)
provides
- The service being providedimpl
- The implementation