Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.picocontainer.containers
Class AbstractDelegatingMutablePicoContainer

    java.lang.Object
      org.picocontainer.containers.AbstractDelegatingPicoContainer
          org.picocontainer.containers.AbstractDelegatingMutablePicoContainer

All Implemented Interfaces:
  Serializable, Disposable, MutablePicoContainer, PicoContainer, Startable

Direct Known Subclasses:
  DefaultClassLoadingPicoContainer

    public abstract class AbstractDelegatingMutablePicoContainer

extends AbstractDelegatingPicoContainer
implements MutablePicoContainer

abstract base class for delegating to mutable containers

Author:
  Paul Hammant
See Also:
  Serialized Form

Constructor Summary
`AbstractDelegatingMutablePicoContainer(MutablePicoContainer delegate)`

Method Summary
`MutablePicoContainer` | `addAdapter(ComponentAdapter<?> componentAdapter)` Register a component via a ComponentAdapter.
`MutablePicoContainer` | `addChildContainer(PicoContainer child)` Add a child container.
`MutablePicoContainer` | `addComponent(Object implOrInstance)` Register an arbitrary object.
`MutablePicoContainer` | `addComponent(Object componentKey, Object componentImplementationOrInstance, 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.
`MutablePicoContainer` | `addConfig(String name, Object val)` Register a config item.
`MutablePicoContainer` | `as(Properties... properties)` You can set for the following operation only the characteristic of registration of a component on the fly.
`MutablePicoContainer` | `change(Properties... properties)` You can change the characteristic of registration of all subsequent components in this container.
`void` | `dispose()` Dispose this component.
`MutablePicoContainer` | `getDelegate()`
`MutablePicoContainer` | `makeChildContainer()` Make a child container, using the same implementation of MutablePicoContainer as the parent.
`boolean` | `removeChildContainer(PicoContainer child)` Remove a child container from this container.
`
`<T> ComponentAdapter<T>`
` | `removeComponent(Object componentKey)` Unregister a component by key.
`
`<T> ComponentAdapter<T>`
` | `removeComponentByInstance(T componentInstance)` Unregister a component by instance.
`void` | `start()` Start this component.
`void` | `stop()` Stop this component.

Methods inherited from class org.picocontainer.containers.AbstractDelegatingPicoContainer
`accept, equals, getComponent, getComponent, getComponent, getComponent, getComponentAdapter, getComponentAdapter, getComponentAdapter, getComponentAdapters, getComponentAdapters, getComponentAdapters, getComponents, getComponents, getParent, toString`

Methods inherited from class java.lang.Object
`clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Methods inherited from interface org.picocontainer.PicoContainer
`accept, getComponent, getComponent, getComponent, getComponent, getComponentAdapter, getComponentAdapter, getComponentAdapter, getComponentAdapters, getComponentAdapters, getComponentAdapters, getComponents, getComponents, getParent`

Constructor Detail

### AbstractDelegatingMutablePicoContainer

    public AbstractDelegatingMutablePicoContainer(MutablePicoContainer delegate)

Method Detail

### addComponent

    public MutablePicoContainer addComponent(Object componentKey,
                                             Object componentImplementationOrInstance,
                                             Parameter... parameters)
                                      throws PicoCompositionException

  Description copied from interface: `MutablePicoContainer`
  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]`

  Specified by:
    `addComponent` in interface `MutablePicoContainer`
  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.
    `componentImplementationOrInstance` - the component's implementation class. This must be a concrete class (ie, a class that can be instantiated). Or an intance of the compoent.
    `parameters` - the 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 same instance of MutablePicoContainer
  Throws:
    `PicoCompositionException` - if registration of the component fails.
  See Also:
    `Parameter`, `ConstantParameter`, `ComponentParameter`

### addComponent

    public MutablePicoContainer addComponent(Object implOrInstance)
                                      throws PicoCompositionException

  Description copied from interface: `MutablePicoContainer`
  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)`.

  Specified by:
    `addComponent` in interface `MutablePicoContainer`
  Parameters:
    `implOrInstance` - Component implementation or instance
  Returns:
    the same instance of MutablePicoContainer
  Throws:
    `PicoCompositionException` - if registration fails.

### addConfig

    public MutablePicoContainer addConfig(String name,
                                          Object val)

  Description copied from interface: `MutablePicoContainer`
  Register a config item.

  Specified by:
    `addConfig` in interface `MutablePicoContainer`
  Parameters:
    `name` - the name of the config item
    `val` - the value of the config item
  Returns:
    the same instance of MutablePicoContainer

### addAdapter

    public MutablePicoContainer addAdapter(ComponentAdapter<?> componentAdapter)
                                    throws PicoCompositionException

  Description copied from interface: `MutablePicoContainer`
  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(...)

  Specified by:
    `addAdapter` in interface `MutablePicoContainer`
  Parameters:
    `componentAdapter` - the adapter
  Returns:
    the same instance of MutablePicoContainer
  Throws:
    `PicoCompositionException` - if registration fails.

### removeComponent

    public <T> ComponentAdapter<T> removeComponent(Object componentKey)

  Description copied from interface: `MutablePicoContainer`
  Unregister a component by key.

  Specified by:
    `removeComponent` in interface `MutablePicoContainer`
  Parameters:
    `componentKey` - key of the component to unregister.
  Returns:
    the ComponentAdapter that was associated with this component.

### removeComponentByInstance

    public <T> ComponentAdapter<T> removeComponentByInstance(T componentInstance)

  Description copied from interface: `MutablePicoContainer`
  Unregister a component by instance.

  Specified by:
    `removeComponentByInstance` in interface `MutablePicoContainer`
  Parameters:
    `componentInstance` - the component instance to unregister.
  Returns:
    the same instance of MutablePicoContainer

### addChildContainer

    public MutablePicoContainer addChildContainer(PicoContainer child)

  Description copied from interface: `MutablePicoContainer`
  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.

  Specified by:
    `addChildContainer` in interface `MutablePicoContainer`
  Parameters:
    `child` - the child container
  Returns:
    the same instance of MutablePicoContainer

### removeChildContainer

    public boolean removeChildContainer(PicoContainer child)

  Description copied from interface: `MutablePicoContainer`
  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.

  Specified by:
    `removeChildContainer` in interface `MutablePicoContainer`
  Parameters:
    `child` - the child container
  Returns:
    `true` if the child container has been removed.

### change

    public MutablePicoContainer change(Properties... properties)

  Description copied from interface: `MutablePicoContainer`
  You can change the characteristic of registration of all subsequent components in this container.

  Specified by:
    `change` in interface `MutablePicoContainer`
  Returns:
    the same Pico instance with changed properties

### as

    public MutablePicoContainer as(Properties... properties)

  Description copied from interface: `MutablePicoContainer`
  You can set for the following operation only the characteristic of registration of a component on the fly.

  Specified by:
    `as` in interface `MutablePicoContainer`
  Returns:
    the same Pico instance with temporary properties

### dispose

    public void dispose()

  Description copied from interface: `Disposable`
  Dispose this component. The component should deallocate all resources. The contract for this method defines a single call at the end of this component's life.

  Specified by:
    `dispose` in interface `Disposable`

### makeChildContainer

    public MutablePicoContainer makeChildContainer()

  Description copied from interface: `MutablePicoContainer`
  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.

  Specified by:
    `makeChildContainer` in interface `MutablePicoContainer`
  Returns:
    the new child container.

### start

    public void start()

  Description copied from interface: `Startable`
  Start this component. Called initially at the begin of the lifecycle. It can be called again after a stop.

  Specified by:
    `start` in interface `Startable`

### stop

    public void stop()

  Description copied from interface: `Startable`
  Stop this component. Called near the end of the lifecycle. It can be called again after a further start. Implement `Disposable` if you need a single call at the definite end of the lifecycle.

  Specified by:
    `stop` in interface `Startable`

### getDelegate

    public MutablePicoContainer getDelegate()

  Overrides:
    `getDelegate` in class `AbstractDelegatingPicoContainer`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2003-2009 Codehaus. All Rights Reserved.