public interface Container extends Startable, Disposable, Serializable
| Modifier and Type | Method and Description |
|---|---|
void |
accept(ContainerVisitor visitor)
Accepts a visitor that should visit the child containers, component adapters and component instances.
|
<T> T |
createComponent(Class<T> clazz,
InitParams params)
Creates a component corresponding to the given
Class with the
given InitParams |
<T> ComponentAdapter<T> |
getComponentAdapter(Object componentKey,
Class<T> bindType,
boolean autoRegistration)
Find a component adapter associated with the specified key.
|
<T> ComponentAdapter<T> |
getComponentAdapterOfType(Class<T> componentType,
boolean autoRegistration)
Find a component adapter associated with the specified type.
|
Collection<ComponentAdapter<?>> |
getComponentAdapters()
Retrieve all the component adapters inside this container.
|
<T> List<ComponentAdapter<T>> |
getComponentAdaptersOfType(Class<T> componentType)
Retrieve all component adapters inside this container that are associated with the specified type.
|
<T> T |
getComponentInstance(Object componentKey,
Class<T> bindType,
boolean autoRegistration)
Retrieve a component instance registered with a specific key.
|
<T> T |
getComponentInstanceOfType(Class<T> componentType,
boolean autoRegistration)
Find a component instance matching the specified type.
|
<T> List<T> |
getComponentInstancesOfType(Class<T> componentType)
Returns a List of components of a certain componentType.
|
ManagementContext |
getManagementContext()
Gives the corresponding
ManagementContext |
MBeanServer |
getMBeanServer()
Provides the
MBeanServer this method is needed for backward compatibility |
ObjectName |
getScopingObjectName()
Gives the ObjectName of the container build from the scoping data
|
Interceptor |
getSuccessor()
Retrieve the successor of this container in the chain of
Interceptor. |
void |
initialize()
Initializes the container
|
<T> ComponentAdapter<T> |
registerComponentImplementation(Object componentKey,
Class<T> componentImplementation)
Register a component.
|
<T> ComponentAdapter<T> |
registerComponentInstance(Object componentKey,
T componentInstance)
Register an arbitrary object as a component in the container.
|
ComponentAdapter<?> |
unregisterComponent(Object componentKey)
Unregister a component by key.
|
dispose<T> T getComponentInstance(Object componentKey, Class<T> bindType, boolean autoRegistration)
componentKey - the key that the component was registered with.bindType - the expected type of the instance if one can be found.autoRegistration - indicates whether the auto registration should be performed or notnull if no component has been registered for the specified
key.<T> T getComponentInstanceOfType(Class<T> componentType, boolean autoRegistration)
componentType - the type of the component.autoRegistration - indicates whether the auto registration should be performed or notInterceptor getSuccessor()
Interceptor.Interceptor instance, or null if this container does not have a successor.<T> ComponentAdapter<T> getComponentAdapter(Object componentKey, Class<T> bindType, boolean autoRegistration)
componentKey - the key that the component was registered with.bindType - the expected raw type of the adapter if one can be found.autoRegistration - indicates whether the auto registration should be performed or notnull if no component has been registered
for the specified key.<T> ComponentAdapter<T> getComponentAdapterOfType(Class<T> componentType, boolean autoRegistration)
componentType - the type of the component.autoRegistration - indicates whether the auto registration should be performed or notnull if no component has been
registered for the specified key.Collection<ComponentAdapter<?>> getComponentAdapters()
ComponentAdapters inside this container. The collection will
not be modifiable.a variant of this method which returns the component adapters inside this
container that are associated with the specified type.<T> List<ComponentAdapter<T>> getComponentAdaptersOfType(Class<T> componentType)
componentType - the type of the components.ComponentAdapters inside this container that are associated with
the specified type. Changes to this collection will not be reflected in the container itself.<T> List<T> getComponentInstancesOfType(Class<T> componentType) throws ContainerException
componentType - the searched type.ContainerExceptionvoid accept(ContainerVisitor visitor)
visitor - the visitor<T> ComponentAdapter<T> registerComponentImplementation(Object componentKey, Class<T> componentImplementation) throws ContainerException
componentKey - a key that identifies the component. Must be unique within the container. The type
of the key object has no semantic significance unless explicitly specified in the
documentation of the implementing container.componentImplementation - the component's implementation class. This must be a concrete class (ie, a
class that can be instantiated).getXXX() methods of the
Container interface can be used to retrieve a reference to the component later on.ContainerException - if registration of the component fails.<T> ComponentAdapter<T> registerComponentInstance(Object componentKey, T componentInstance) throws ContainerException
componentKey - a key that identifies the component. Must be unique within the container. The type of the
key object has no semantic significance unless explicitly specified in the implementing
container.componentInstance - an arbitrary object.getXXX() methods of the
Container interface can be used to retrieve a reference to the component later on.ContainerException - if registration fails.ComponentAdapter<?> unregisterComponent(Object componentKey)
componentKey - key of the component to unregister.ManagementContext getManagementContext()
ManagementContextMBeanServer getMBeanServer()
MBeanServer this method is needed for backward compatibilityObjectName getScopingObjectName()
<T> T createComponent(Class<T> clazz, InitParams params) throws Exception
Class with the
given InitParamsclazz - the Class of the object to createparams - the parameters to use to create the componentException - if any issue occurs while creating the component.void initialize()
Copyright © 2020 eXo Platform SAS. All Rights Reserved.