| org.picocontainer.MutablePicoContainer
All known Subclasses: org.picocontainer.gems.containers.Log4jTracingContainerDecorator, org.picocontainer.DefaultPicoContainer, org.picocontainer.gems.containers.CommonsLoggingTracingContainerDecorator, org.picocontainer.containers.AbstractDelegatingMutablePicoContainer,
addAdapter | MutablePicoContainer addAdapter(ComponentAdapter> componentAdapter)(Code) | | Register a component via a ComponentAdapter. Use this if you need fine grained control over what
ComponentAdapter to use for a specific component. The adapter will be wrapped in whatever behaviors that the
the container has been set up with. If you want to bypass that behavior for the adapter you are adding,
you should use Characteristics.NONE like so pico.as(Characteristics.NONE).addAdapter(...)
Parameters: componentAdapter - the adapter the same instance of MutablePicoContainer throws: PicoCompositionException - if registration fails. |
addChildContainer | MutablePicoContainer addChildContainer(PicoContainer child)(Code) | | Add a child container. This action will list the the 'child' as exactly that in the parents scope.
It will not change the child's view of a parent. That is determined by the constructor arguments of the child
itself. Lifecycle events will be cascaded from parent to child
as a consequence of calling this method.
Parameters: child - the child container the same instance of MutablePicoContainer |
addComponent | MutablePicoContainer addComponent(Object componentKey, Object componentImplementationOrInstance, Parameter... parameters)(Code) | | Register a component and creates specific instructions on which constructor to use, along with
which components and/or constants to provide as constructor arguments. These "directives" are
provided through an array of Parameter objects. Parameter[0] correspondes to the first constructor
argument, Parameter[N] corresponds to the N+1th constructor argument.
Tips for Parameter usage
- Partial Autowiring: If you have two constructor args to match and you only wish to specify one of the constructors and
let PicoContainer wire the other one, you can use as parameters:
new ComponentParameter(), new ComponentParameter("someService")
The default constructor for the component parameter indicates auto-wiring should take place for
that parameter.
- Force No-Arg constructor usage: If you wish to force a component to be constructed with
the no-arg constructor, use a zero length Parameter array. Ex:
new Parameter[0]
Parameters: componentKey - a key that identifies the component. Must be unique within the container. The typeof the key object has no semantic significance unless explicitly specified in thedocumentation of the implementing container. Parameters: componentImplementationOrInstance - the component's implementation class. This must be a concrete class (ie, aclass that can be instantiated). Or an intance of the compoent. Parameters: parameters - the parameters that gives the container hints about what arguments to passto the constructor when it is instantiated. Container implementations may ignoreone or more of these hints. the same instance of MutablePicoContainer throws: PicoCompositionException - if registration of the component fails. See Also: org.picocontainer.Parameter See Also: org.picocontainer.parameters.ConstantParameter See Also: org.picocontainer.parameters.ComponentParameter |
addComponent | MutablePicoContainer addComponent(Object implOrInstance)(Code) | | Register an arbitrary object. The class of the object will be used as a key. Calling this method is equivalent to
calling addComponent(componentImplementation, componentImplementation) .
Parameters: implOrInstance - Component implementation or instance the same instance of MutablePicoContainer throws: PicoCompositionException - if registration fails. |
as | MutablePicoContainer as(Properties... properties)(Code) | | You can set for the following operation only the characteristic of registration of a component on the fly.
Parameters: properties - the same Pico instance with temporary properties |
change | MutablePicoContainer change(Properties... properties)(Code) | | You can change the characteristic of registration of all subsequent components in this container.
Parameters: properties - the same Pico instance with changed properties |
makeChildContainer | MutablePicoContainer makeChildContainer()(Code) | | Make a child container, using the same implementation of MutablePicoContainer as the parent.
It will have a reference to this as parent. This will list the resulting MPC as a child.
Lifecycle events will be cascaded from parent to child
as a consequence of this.
the new child container. |
removeChildContainer | boolean removeChildContainer(PicoContainer child)(Code) | | Remove a child container from this container. It will not change the child's view of a parent.
Lifecycle event will no longer be cascaded from the parent to the child.
Parameters: child - the child container true if the child container has been removed. |
removeComponent | ComponentAdapter<T> removeComponent(Object componentKey)(Code) | | Unregister a component by key.
Parameters: componentKey - key of the component to unregister. the ComponentAdapter that was associated with this component. |
removeComponentByInstance | ComponentAdapter<T> removeComponentByInstance(T componentInstance)(Code) | | Unregister a component by instance.
Parameters: componentInstance - the component instance to unregister. the same instance of MutablePicoContainer |
|
|