|
![]() |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
This is the core interface used for registration of components with a container. It is possible to register an implementation class
, an
instance
or a ComponentAdapter
.
Method Summary | |
ComponentAdapter |
registerComponent(ComponentAdapter componentAdapter)
Register a component via a ComponentAdapter. |
ComponentAdapter |
registerComponentImplementation(Class componentImplementation)
Register a component using the componentImplementation as key. |
ComponentAdapter |
registerComponentImplementation(Object componentKey,
Class componentImplementation)
Register a component. |
ComponentAdapter |
registerComponentImplementation(Object componentKey,
Class componentImplementation,
Parameter[] parameters)
Register a component. |
ComponentAdapter |
registerComponentInstance(Object componentInstance)
Register an arbitrary object. |
ComponentAdapter |
registerComponentInstance(Object componentKey,
Object componentInstance)
Register an arbitrary object as a component in the container. |
void |
setParent(PicoContainer parent)
Deprecated. This will probably go away. implementations should take the parent in the constructor (constructor injection!) |
ComponentAdapter |
unregisterComponent(Object componentKey)
Unregister a component by key. |
ComponentAdapter |
unregisterComponentByInstance(Object componentInstance)
Unregister a component by instance. |
Methods inherited from interface org.picocontainer.PicoContainer |
addOrderedComponentAdapter, getComponentAdapter, getComponentAdapterOfType, getComponentAdapters, getComponentAdaptersOfType, getComponentInstance, getComponentInstanceOfType, getComponentInstances, getParent, verify |
Methods inherited from interface org.picocontainer.Startable |
start, stop |
Methods inherited from interface org.picocontainer.Disposable |
dispose |
Method Detail |
public ComponentAdapter registerComponentImplementation(Object componentKey, Class componentImplementation) throws PicoRegistrationException
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
PicoContainer
interface can be used to retrieve a reference to the component later on.
PicoRegistrationException
- if registration of the component fails.a variant of this method that allows more control
over the parameters passed into the componentImplementation constructor when constructing an instance.
public ComponentAdapter registerComponentImplementation(Object componentKey, Class componentImplementation, Parameter[] parameters) throws PicoRegistrationException
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).parameters
- an array of parameters that gives the container hints about what arguments to pass
to the constructor when it is instantiated. Container implementations may ignore
one or more of these hints.
getXXX()
methods of the
PicoContainer
interface can be used to retrieve a reference to the component later on.
PicoRegistrationException
- if registration of the component fails.public ComponentAdapter registerComponentImplementation(Class componentImplementation) throws PicoRegistrationException
registerComponentImplementation(componentImplementation, componentImplementation)
.
componentImplementation
- the concrete component class.
getXXX()
methods of the
PicoContainer
interface can be used to retrieve a reference to the component later on.
PicoRegistrationException
- if registration fails.public ComponentAdapter registerComponentInstance(Object componentInstance) throws PicoRegistrationException
registerComponentImplementation(componentImplementation, componentImplementation)
.
componentInstance
-
getXXX()
methods of the
PicoContainer
interface can be used to retrieve a reference to the component later on.
PicoRegistrationException
- if registration fails.public ComponentAdapter registerComponentInstance(Object componentKey, Object componentInstance) throws PicoRegistrationException
componentKey
- a key that identifies the component. Must be unique within the conainer. 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
PicoContainer
interface can be used to retrieve a reference to the component later on.
PicoRegistrationException
- if registration fails.public ComponentAdapter registerComponent(ComponentAdapter componentAdapter) throws PicoRegistrationException
componentAdapter
- the adapter
PicoRegistrationException
- if registration fails.public ComponentAdapter unregisterComponent(Object componentKey)
componentKey
- key of the component to unregister.
public ComponentAdapter unregisterComponentByInstance(Object componentInstance)
componentInstance
- the component instance to unregister.
public void setParent(PicoContainer parent)
parent
- parent container.
|
![]() |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |