|
![]() |
||||||||||
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 | |
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(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 and creates specific instructions on which constructor to use, along with which components and/or constants to provide as constructor arguments. |
ComponentAdapter |
registerComponentInstance(Object componentInstance)
Register an arbitrary object. |
ComponentAdapter |
registerComponentInstance(Object componentKey,
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(Object componentKey)
Unregister a component by key. |
ComponentAdapter |
unregisterComponentByInstance(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 |
public ComponentAdapter registerComponentImplementation(Object componentKey, 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.
public ComponentAdapter registerComponentImplementation(Object componentKey, 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
public ComponentAdapter registerComponentImplementation(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.public ComponentAdapter registerComponentInstance(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.public ComponentAdapter registerComponentInstance(Object componentKey, 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.public ComponentAdapter registerComponent(ComponentAdapter componentAdapter)
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 MutablePicoContainer makeChildContainer()
public boolean addChildContainer(PicoContainer child)
child
- the child container
true
if the child container was not already in.public 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 |