org.picocontainer
Interface PicoContainer

All Superinterfaces:
Disposable, Startable
All Known Subinterfaces:
MutablePicoContainer
All Known Implementing Classes:
DefaultPicoContainer, NullPicoContainer

public interface PicoContainer
extends Startable, Disposable

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.

Version:
$Revision: 1.31 $
Author:
Paul Hammant, Aslak Hellesøy, Jon Tirsén

Method Summary
 void addOrderedComponentAdapter(ComponentAdapter componentAdapter)
          Callback method from the implementation to keep track of the instantiation order.
 ComponentAdapter getComponentAdapter(java.lang.Object componentKey)
          Finds a ComponentAdapter matching the key, looking in parent if not found in self (unless parent is null).
 ComponentAdapter getComponentAdapterOfType(java.lang.Class componentType)
          Finds a ComponentAdapter matching the type, looking in parent if not found in self (unless parent is null).
 java.util.Collection getComponentAdapters()
          Returns all adapters (not including the adapters from the parent).
 java.lang.Object getComponentInstance(java.lang.Object componentKey)
          Gets a component instance registered with a specific key.
 java.lang.Object getComponentInstanceOfType(java.lang.Class componentType)
          Finds a component instance matching the type, looking in parent if not found in self (unless parent is null).
 java.util.List getComponentInstances()
          Gets all the registered component instances in the container, (not including those in the parent container).
 PicoContainer getParent()
          Get the parent container of this container.
 void verify()
          Verifies that the dependencies for all the registered components can be satisfied None of the components are instantiated during the verification process.
 
Methods inherited from interface org.picocontainer.Startable
start, stop
 
Methods inherited from interface org.picocontainer.Disposable
dispose
 

Method Detail

getComponentInstance

public java.lang.Object getComponentInstance(java.lang.Object componentKey)
Gets a component instance registered with a specific key.

Parameters:
componentKey - key the component was registered with.
Returns:
an instantiated component.

getComponentInstanceOfType

public java.lang.Object getComponentInstanceOfType(java.lang.Class componentType)
Finds a component instance matching the type, looking in parent if not found in self (unless parent is null).

Parameters:
componentType - type of the component.
Returns:
the adapter matching the class.

getComponentInstances

public java.util.List getComponentInstances()
Gets all the registered component instances in the container, (not including those in the parent container). The components are returned in their order of instantiation, which depends on the dependency order between them.

Returns:
all the components.

getParent

public PicoContainer getParent()
Get the parent container of this container.

Returns:
a Collection of PicoContainer.

getComponentAdapter

public ComponentAdapter getComponentAdapter(java.lang.Object componentKey)
Finds a ComponentAdapter matching the key, looking in parent if not found in self (unless parent is null).

Parameters:
componentKey - key of the component.
Returns:
the adapter matching the key.

getComponentAdapterOfType

public ComponentAdapter getComponentAdapterOfType(java.lang.Class componentType)
Finds a ComponentAdapter matching the type, looking in parent if not found in self (unless parent is null).

Parameters:
componentType - type of the component.
Returns:
the adapter matching the class.

getComponentAdapters

public java.util.Collection getComponentAdapters()
Returns all adapters (not including the adapters from the parent).

Returns:
Collection of ComponentAdapter.

verify

public void verify()
            throws PicoVerificationException
Verifies that the dependencies for all the registered components can be satisfied None of the components are instantiated during the verification process.

Throws:
PicoVerificationException - if there are unsatisifiable dependencies.

addOrderedComponentAdapter

public void addOrderedComponentAdapter(ComponentAdapter componentAdapter)
Callback method from the implementation to keep track of the instantiation order. This method is not intended to be called explicitly by clients of the API!



Copyright © 2003-2004 Codehaus. All Rights Reserved.