|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
This is the core interface for PicoContainer. It only has accessor methods.
In order to register components in a PicoContainer, use a MutablePicoContainer
,
such as DefaultPicoContainer
.
Method Summary | |
ComponentAdapter |
findComponentAdapter(Object componentKey)
Finds a ComponentAdapter matching the key. |
Collection |
getChildContainers()
Get the child containers of this container. |
Object |
getComponentInstance(Object componentKey)
Gets a component instance. |
List |
getComponentInstances()
Gets all the registered component instances in the container. |
Collection |
getComponentKeys()
Get all the component keys. |
Object |
getComponentMulticaster()
Shorthand for getComponentMulticaster(boolean, boolean) |
Object |
getComponentMulticaster(boolean callInInstantiationOrder,
boolean callUnmanagedComponents)
Returns an object (in fact, a dynamic proxy) that implements the union of all the interfaces of the currently registered components. |
List |
getParentContainers()
Get the parent containers of this container. |
boolean |
hasComponent(Object componentKey)
Checks for the presence of a particular component. |
Method Detail |
public Object getComponentInstance(Object componentKey) throws PicoException
componentKey
- key the component was registered with.
PicoException
- if the component could not be instantiated or dependencies
could not be properly resolved.public List getComponentInstances() throws PicoException
PicoException
- if one of the components could not be instantiated or dependencies
could not be properly resolved.public boolean hasComponent(Object componentKey)
componentKey
- key of the component to look for.
public Object getComponentMulticaster(boolean callInInstantiationOrder, boolean callUnmanagedComponents) throws PicoException
Casting this object to any of those interfaces and then calling a method on it will result in that call being multicast to all the components implementing that given interface.
This is a simple yet extremely powerful way to handle lifecycle of components. Component writers can invent their own lifecycle interfaces, and then use the multicaster to invoke the method in one go.
callInInstantiationOrder
- whether or not to call the method in the order of instantiation,
which depends on the components' inter-dependencies.callUnmanagedComponents
- whether or not to multicast to components that are not managed
by this container.
PicoException
public Object getComponentMulticaster() throws PicoException
getComponentMulticaster(boolean, boolean)
(true, false), which is the most common usage scenario.
PicoException
public Collection getComponentKeys()
public Collection getChildContainers()
PicoContainer
.getParentContainers()
public List getParentContainers()
PicoContainer
.public ComponentAdapter findComponentAdapter(Object componentKey) throws PicoIntrospectionException
componentKey
- key of the component.
PicoIntrospectionException
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |