public class SimpleMutableContext extends Object implements MutableContext
| Constructor and Description |
|---|
SimpleMutableContext(Context... chain) |
SimpleMutableContext(Map<Class<?>,Collection<?>> services,
Map<String,?> bindings,
Context... chain) |
| Modifier and Type | Method and Description |
|---|---|
void |
bind(String name,
Object value)
Binds named object.
|
<T> T |
lookup(Class<T> serviceClass,
Predicate<T,Context>... selectors)
Looks up single object (service) by type.
|
Object |
lookup(String name)
Looks up object by name.
|
<T> Iterator<T> |
lookupAll(Class<T> serviceClass,
Predicate<T,Context>... selectors)
Looks up all services of given type.
|
<T> void |
register(Class<? super T> serviceType,
T service)
Registers service.
|
Object |
unbind(String name)
Unbinds named object.
|
<T> void |
unregister(Class<? super T> serviceType,
T service)
Removes service registration.
|
public SimpleMutableContext(Context... chain)
public SimpleMutableContext(Map<Class<?>,Collection<?>> services, Map<String,?> bindings, Context... chain)
classLoader - ClassLoader for services. Can be null.bindings - Name bindings. Can be null.public void bind(String name, Object value)
MutableContextbind in interface MutableContextname - Object name.value - Object reference. Cannot be null.public Object unbind(String name)
MutableContextunbind in interface MutableContextpublic <T> void register(Class<? super T> serviceType, T service)
MutableContextregister in interface MutableContextT - Service implementation type.serviceType - Service type.service - Service instance.public <T> void unregister(Class<? super T> serviceType, T service)
MutableContextunregister in interface MutableContextpublic Object lookup(String name)
Contextpublic <T> T lookup(Class<T> serviceClass, Predicate<T,Context>... selectors)
Context