|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface MutablePicoContainer
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 | |
---|---|
boolean |
addChildContainer(PicoContainer child)
Add a child container. |
MutablePicoContainer |
makeChildContainer()
Make a child container, using the same implementation of MutablePicoContainer as the parent. |
ComponentAdapter |
registerComponent(ComponentAdapter componentAdapter)
Register a component via a ComponentAdapter. |
ComponentAdapter |
registerComponentImplementation(java.lang.Class componentImplementation)
Register a component using the componentImplementation as key. |
ComponentAdapter |
registerComponentImplementation(java.lang.Object componentKey,
java.lang.Class componentImplementation)
Register a component. |
ComponentAdapter |
registerComponentImplementation(java.lang.Object componentKey,
java.lang.Class componentImplementation,
Parameter[] parameters)
Register a component and creates specific instructions on which constructor to use, along with which components and/or constants to provide as constructor arguments. |
ComponentAdapter |
registerComponentInstance(java.lang.Object componentInstance)
Register an arbitrary object. |
ComponentAdapter |
registerComponentInstance(java.lang.Object componentKey,
java.lang.Object componentInstance)
Register an arbitrary object as a component in the container. |
boolean |
removeChildContainer(PicoContainer child)
Remove a child container from this container. |
ComponentAdapter |
unregisterComponent(java.lang.Object componentKey)
Unregister a component by key. |
ComponentAdapter |
unregisterComponentByInstance(java.lang.Object componentInstance)
Unregister a component by instance. |
Methods inherited from interface org.picocontainer.PicoContainer |
---|
accept, getComponentAdapter, getComponentAdapterOfType, getComponentAdapters, getComponentAdaptersOfType, getComponentInstance, getComponentInstanceOfType, getComponentInstances, getComponentInstancesOfType, getParent, verify |
Methods inherited from interface org.picocontainer.Startable |
---|
start, stop |
Methods inherited from interface org.picocontainer.Disposable |
---|
dispose |
Method Detail |
---|
ComponentAdapter registerComponentImplementation(java.lang.Object componentKey, java.lang.Class componentImplementation)
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.
ComponentAdapter registerComponentImplementation(java.lang.Object componentKey, java.lang.Class componentImplementation, Parameter[] parameters)
new Parameter[]{new ComponentParameter(), new ComponentParameter("someService"}
The default constructor for the component parameter indicates auto-wiring should take place for
that parameter.
new Parameter[] {}
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.Parameter
,
ConstantParameter
,
ComponentParameter
ComponentAdapter registerComponentImplementation(java.lang.Class componentImplementation)
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.ComponentAdapter registerComponentInstance(java.lang.Object componentInstance)
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.ComponentAdapter registerComponentInstance(java.lang.Object componentKey, java.lang.Object componentInstance)
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.ComponentAdapter registerComponent(ComponentAdapter componentAdapter)
componentAdapter
- the adapter
PicoRegistrationException
- if registration fails.ComponentAdapter unregisterComponent(java.lang.Object componentKey)
componentKey
- key of the component to unregister.
ComponentAdapter unregisterComponentByInstance(java.lang.Object componentInstance)
componentInstance
- the component instance to unregister.
MutablePicoContainer makeChildContainer()
boolean addChildContainer(PicoContainer child)
child
- the child container
true
if the child container was not already in.boolean removeChildContainer(PicoContainer child)
child
- the child container
true
if the child container has been removed.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |