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 ImmutablePicoContainer

    java.lang.Object
      org.picocontainer.containers.ImmutablePicoContainer

All Implemented Interfaces:
  Serializable, PicoContainer

    public final class ImmutablePicoContainer

extends Object
implements PicoContainer, Serializable

wrap pico container to achieve immutability Typically its used to mock a parent container.

Author:
  Konstantin Pribluda
See Also:
  Serialized Form

Constructor Summary
`ImmutablePicoContainer(PicoContainer delegate)`

Method Summary
`void` | `accept(PicoVisitor visitor)` Accepts a visitor that should visit the child containers, component adapters and component instances.
`boolean` | `equals(Object obj)`
`
`<T> T`
` | `getComponent(Class<T> componentType)` Retrieve a component keyed by the component type.
`
`<T> T`
` | `getComponent(Class<T> componentType, Class<? extends Annotation> binding)`
`Object` | `getComponent(Object componentKeyOrType)` Retrieve a component instance registered with a specific key or type.
`Object` | `getComponent(Object componentKeyOrType, Type into)`
`
`<T> ComponentAdapter<T>`
` | `getComponentAdapter(Class<T> componentType, Class<? extends Annotation> binding)`
`
`<T> ComponentAdapter<T>`
` | `getComponentAdapter(Class<T> componentType, NameBinding componentNameBinding)` Find a component adapter associated with the specified type.
`ComponentAdapter<?>` | `getComponentAdapter(Object componentKey)` Find a component adapter associated with the specified key.
`Collection<ComponentAdapter<?>>` | `getComponentAdapters()` Retrieve all the component adapters inside this container.
`
`<T> List<ComponentAdapter<T>>`
` | `getComponentAdapters(Class<T> componentType)` Retrieve all component adapters inside this container that are associated with the specified type.
`
`<T> List<ComponentAdapter<T>>`
` | `getComponentAdapters(Class<T> componentType, Class<? extends Annotation> binding)`
`List` | `getComponents()` Retrieve all the registered component instances in the container, (not including those in the parent container).
`
`<T> List<T>`
` | `getComponents(Class<T> componentType)` Returns a List of components of a certain componentType.
`PicoContainer` | `getParent()` Retrieve the parent container of this container.
`int` | `hashCode()`
`String` | `toString()`

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

Constructor Detail

### ImmutablePicoContainer

    public ImmutablePicoContainer(PicoContainer delegate)

Method Detail

### getComponent

    public Object getComponent(Object componentKeyOrType)

  Description copied from interface: `PicoContainer`
  Retrieve a component instance registered with a specific key or type. If a component cannot be found in this container, the parent container (if one exists) will be searched.

  Specified by:
    `getComponent` in interface `PicoContainer`
  Parameters:
    `componentKeyOrType` - the key or Type that the component was registered with.
  Returns:
    an instantiated component, or `null` if no component has been registered for the specified key.

### getComponent

    public Object getComponent(Object componentKeyOrType,
                               Type into)

  Specified by:
    `getComponent` in interface `PicoContainer`

### getComponent

    public <T> T getComponent(Class<T> componentType)

  Description copied from interface: `PicoContainer`
  Retrieve a component keyed by the component type.

  Specified by:
    `getComponent` in interface `PicoContainer`
  Type Parameters:
    `T` - the type of the component.
  Parameters:
    `componentType` - the type of the component
  Returns:
    the typed resulting object instance or null if the object does not exist.

### getComponent

    public <T> T getComponent(Class<T> componentType,
                              Class<? extends Annotation> binding)

  Specified by:
    `getComponent` in interface `PicoContainer`

### getComponents

    public List getComponents()

  Description copied from interface: `PicoContainer`
  Retrieve all the registered component instances in the container, (not including those in the parent container). The components are returned in their order of instantiation, which depends on the dependency order between them.

  Specified by:
    `getComponents` in interface `PicoContainer`
  Returns:
    all the components.

### getParent

    public PicoContainer getParent()

  Description copied from interface: `PicoContainer`
  Retrieve the parent container of this container.

  Specified by:
    `getParent` in interface `PicoContainer`
  Returns:
    a `PicoContainer` instance, or `null` if this container does not have a parent.

### getComponentAdapter

    public ComponentAdapter<?> getComponentAdapter(Object componentKey)

  Description copied from interface: `PicoContainer`
  Find a component adapter associated with the specified key. If a component adapter cannot be found in this container, the parent container (if one exists) will be searched.

  Specified by:
    `getComponentAdapter` in interface `PicoContainer`
  Parameters:
    `componentKey` - the key that the component was registered with.
  Returns:
    the component adapter associated with this key, or `null` if no component has been registered for the specified key.

### getComponentAdapter

    public <T> ComponentAdapter<T> getComponentAdapter(Class<T> componentType,
                                                       NameBinding componentNameBinding)

  Description copied from interface: `PicoContainer`
  Find a component adapter associated with the specified type. If a component adapter cannot be found in this container, the parent container (if one exists) will be searched.

  Specified by:
    `getComponentAdapter` in interface `PicoContainer`
  Parameters:
    `componentType` - the type of the component.
  Returns:
    the component adapter associated with this class, or `null` if no component has been registered for the specified key.

### getComponentAdapter

    public <T> ComponentAdapter<T> getComponentAdapter(Class<T> componentType,
                                                       Class<? extends Annotation> binding)

  Specified by:
    `getComponentAdapter` in interface `PicoContainer`

### getComponentAdapters

    public Collection<ComponentAdapter<?>> getComponentAdapters()

  Description copied from interface: `PicoContainer`
  Retrieve all the component adapters inside this container. The component adapters from the parent container are not returned.

  Specified by:
    `getComponentAdapters` in interface `PicoContainer`
  Returns:
    a collection containing all the `ComponentAdapter`s inside this container. The collection will not be modifiable.
  See Also:
    `a variant of this method which returns the component adapters inside this container that are associated with the specified type.`

### getComponentAdapters

    public <T> List<ComponentAdapter<T>> getComponentAdapters(Class<T> componentType)

  Description copied from interface: `PicoContainer`
  Retrieve all component adapters inside this container that are associated with the specified type. The addComponent adapters from the parent container are not returned.

  Specified by:
    `getComponentAdapters` in interface `PicoContainer`
  Parameters:
    `componentType` - the type of the components.
  Returns:
    a collection containing all the `ComponentAdapter`s inside this container that are associated with the specified type. Changes to this collection will not be reflected in the container itself.

### getComponentAdapters

    public <T> List<ComponentAdapter<T>> getComponentAdapters(Class<T> componentType,
                                                              Class<? extends Annotation> binding)

  Specified by:
    `getComponentAdapters` in interface `PicoContainer`

### getComponents

    public <T> List<T> getComponents(Class<T> componentType)

  Description copied from interface: `PicoContainer`
  Returns a List of components of a certain componentType. The list is ordered by instantiation order, starting with the components instantiated first at the beginning.

  Specified by:
    `getComponents` in interface `PicoContainer`
  Parameters:
    `componentType` - the searched type.
  Returns:
    a List of components.

### accept

    public final void accept(PicoVisitor visitor)

  Description copied from interface: `PicoContainer`
  Accepts a visitor that should visit the child containers, component adapters and component instances.

  Specified by:
    `accept` in interface `PicoContainer`
  Parameters:
    `visitor` - the visitor

### equals

    public boolean equals(Object obj)

  Overrides:
    `equals` in class `Object`

### hashCode

    public int hashCode()

  Overrides:
    `hashCode` in class `Object`

### toString

    public String toString()

  Overrides:
    `toString` in class `Object`

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.