org.picocontainer
public interface MutablePicoContainer extends PicoContainer
an implementation class
, an
instance
or a ComponentAdapter
.
Since: 1.0
See Also: See package description for basic overview how to use PicoContainer.
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(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 | registerComponentImplementation(Class componentImplementation)
Register a component using the componentImplementation as key. |
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.
|
Parameters: child the child container
Returns: true
if the child container was not already in.
Since: 1.1
Returns: the new child container.
Since: 1.1
Parameters: componentAdapter the adapter
Returns: the same adapter that was passed as an argument.
Throws: PicoRegistrationException if registration fails.
Parameters: 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).
Returns: the ComponentAdapter that has been associated with this component. In the majority of cases, this return
value can be safely ignored, as one of the getXXX()
methods of the
PicoContainer interface can be used to retrieve a reference to the component later on.
Throws: PicoRegistrationException if registration of the component fails.
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[] {}
Parameters: 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.
Returns: the ComponentAdapter that has been associated with this component. In the majority of cases, this return
value can be safely ignored, as one of the getXXX()
methods of the
PicoContainer interface can be used to retrieve a reference to the component later on.
Throws: PicoRegistrationException if registration of the component fails.
See Also: Parameter org.picocontainer.defaults.ConstantParameter org.picocontainer.defaults.ComponentParameter
registerComponentImplementation(componentImplementation, componentImplementation)
.
Parameters: componentImplementation the concrete component class.
Returns: the ComponentAdapter that has been associated with this component. In the majority of cases, this return
value can be safely ignored, as one of the getXXX()
methods of the
PicoContainer interface can be used to retrieve a reference to the component later on.
Throws: PicoRegistrationException if registration fails.
registerComponentImplementation(componentImplementation, componentImplementation)
.
Parameters: componentInstance
Returns: the ComponentAdapter that has been associated with this component. In the majority of cases, this return
value can be safely ignored, as one of the getXXX()
methods of the
PicoContainer interface can be used to retrieve a reference to the component later on.
Throws: PicoRegistrationException if registration fails.
Parameters: 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.
Returns: the ComponentAdapter that has been associated with this component. In the majority of cases, this return
value can be safely ignored, as one of the getXXX()
methods of the
PicoContainer interface can be used to retrieve a reference to the component later on.
Throws: PicoRegistrationException if registration fails.
Parameters: child the child container
Returns: true
if the child container has been removed.
Since: 1.1
Parameters: componentKey key of the component to unregister.
Returns: the ComponentAdapter that was associated with this component.
Parameters: componentInstance the component instance to unregister.
Returns: the ComponentAdapter that was associated with this component.