|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface PicoContainer
This is the core interface for PicoContainer. It is used to retrieve component instances from the container; it only
has accessor methods (in addition to the accept(PicoVisitor)
method). In order to register components in a
PicoContainer, use a MutablePicoContainer
, such as DefaultPicoContainer
.
Method Summary | ||
---|---|---|
void |
accept(PicoVisitor visitor)
Accepts a visitor that should visit the child containers, component adapters and component instances. |
|
|
getComponent(Class<T> componentType)
Retrieve a component keyed by the component type. |
|
|
getComponent(Class<T> componentType,
Class<? extends Annotation> binding)
Retrieve a component keyed by the component type and binding type. |
|
Object |
getComponent(Object componentKeyOrType)
Retrieve a component instance registered with a specific key or type. |
|
Object |
getComponent(Object componentKeyOrType,
Type into)
|
|
|
getComponentAdapter(Class<T> componentType,
Class<? extends Annotation> binding)
Find a component adapter associated with the specified type and binding type. |
|
|
getComponentAdapter(Class<T> componentType,
NameBinding componentNameBinding)
Find a component adapter associated with the specified type and binding name. |
|
ComponentAdapter<?> |
getComponentAdapter(Object componentKey)
Find a component adapter associated with the specified key. |
|
Collection<ComponentAdapter<?>> |
getComponentAdapters()
Retrieve all the component adapters inside this container. |
|
|
getComponentAdapters(Class<T> componentType)
Retrieve all component adapters inside this container that are associated with the specified type. |
|
|
getComponentAdapters(Class<T> componentType,
Class<? extends Annotation> binding)
Retrieve all component adapters inside this container that are associated with the specified type and binding type. |
|
List<Object> |
getComponents()
Retrieve all the registered component instances in the container, (not including those in the parent container). |
|
|
getComponents(Class<T> componentType)
Returns a List of components of a certain componentType. |
|
PicoContainer |
getParent()
Retrieve the parent container of this container. |
Method Detail |
---|
Object getComponent(Object componentKeyOrType)
componentKeyOrType
- the key or Type that the component was registered with.
null
if no component has been registered for the specified
key.Object getComponent(Object componentKeyOrType, Type into)
<T> T getComponent(Class<T> componentType)
componentType
- the type of the component
<T> T getComponent(Class<T> componentType, Class<? extends Annotation> binding)
componentType
- the type of the componentbinding
- the binding type of the component
List<Object> getComponents()
PicoException
- if the instantiation of the component failsPicoContainer getParent()
PicoContainer
instance, or null
if this container does not have a parent.ComponentAdapter<?> getComponentAdapter(Object componentKey)
componentKey
- the key that the component was registered with.
null
if no component has been
registered for the specified key.<T> ComponentAdapter<T> getComponentAdapter(Class<T> componentType, NameBinding componentNameBinding)
componentType
- the type of the component.componentNameBinding
- the name binding to use
null
if no component has been
registered for the specified key.<T> ComponentAdapter<T> getComponentAdapter(Class<T> componentType, Class<? extends Annotation> binding)
componentType
- the type of the component.binding
- the typed binding to use
null
if no component has been
registered for the specified key.Collection<ComponentAdapter<?>> getComponentAdapters()
ComponentAdapter
s 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>> getComponentAdapters(Class<T> componentType)
componentType
- the type of the components.
ComponentAdapter
s inside this container that are associated with
the specified type. Changes to this collection will not be reflected in the container itself.<T> List<ComponentAdapter<T>> getComponentAdapters(Class<T> componentType, Class<? extends Annotation> binding)
componentType
- the type of the components.binding
- the typed binding to use
ComponentAdapter
s 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> getComponents(Class<T> componentType)
componentType
- the searched type.
PicoException
- if the instantiation of a component failsvoid accept(PicoVisitor visitor)
visitor
- the visitor
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |