org.picocontainer.alternatives
Class ImplementationHidingPicoContainer

java.lang.Object
  extended by org.picocontainer.alternatives.AbstractDelegatingMutablePicoContainer
      extended by org.picocontainer.alternatives.ImplementationHidingPicoContainer
All Implemented Interfaces:
java.io.Serializable, Disposable, MutablePicoContainer, PicoContainer, Startable

public class ImplementationHidingPicoContainer
extends AbstractDelegatingMutablePicoContainer
implements java.io.Serializable

This special MutablePicoContainer hides implementations of components if the key is an interface. It's very simple. Instances that are registered directly and components registered without key are not hidden. Hiding is achieved with dynamic proxies from Java's reflection api.

Version:
$Revision: 2424 $
Author:
Paul Hammant
See Also:
CachingPicoContainer, ImplementationHidingCachingPicoContainer, Serialized Form

Field Summary
private  ComponentAdapterFactory caf
           
 
Constructor Summary
ImplementationHidingPicoContainer()
          Creates a new container with no parent container.
ImplementationHidingPicoContainer(ComponentAdapterFactory caf)
          Creates a new container with a parent container.
ImplementationHidingPicoContainer(ComponentAdapterFactory caf, PicoContainer parent)
          Creates a new container with a parent container.
ImplementationHidingPicoContainer(PicoContainer parent)
          Creates a new container with a parent container.
 
Method Summary
 MutablePicoContainer makeChildContainer()
          Make a child container, using the same implementation of MutablePicoContainer as the parent.
private static ImplementationHidingComponentAdapterFactory makeComponentAdapterFactory(ComponentAdapterFactory caf)
           
 
Methods inherited from class org.picocontainer.alternatives.AbstractDelegatingMutablePicoContainer
accept, addChildContainer, dispose, equals, getComponentAdapter, getComponentAdapterOfType, getComponentAdapters, getComponentAdaptersOfType, getComponentInstance, getComponentInstanceOfType, getComponentInstances, getComponentInstancesOfType, getDelegate, getParent, registerComponent, registerComponentImplementation, registerComponentImplementation, registerComponentImplementation, registerComponentInstance, registerComponentInstance, removeChildContainer, start, stop, unregisterComponent, unregisterComponentByInstance, verify
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

caf

private final ComponentAdapterFactory caf
Constructor Detail

ImplementationHidingPicoContainer

public ImplementationHidingPicoContainer(ComponentAdapterFactory caf,
                                         PicoContainer parent)
Creates a new container with a parent container.


ImplementationHidingPicoContainer

public ImplementationHidingPicoContainer(PicoContainer parent)
Creates a new container with a parent container.


ImplementationHidingPicoContainer

public ImplementationHidingPicoContainer(ComponentAdapterFactory caf)
Creates a new container with a parent container.


ImplementationHidingPicoContainer

public ImplementationHidingPicoContainer()
Creates a new container with no parent container.

Method Detail

makeComponentAdapterFactory

private static ImplementationHidingComponentAdapterFactory makeComponentAdapterFactory(ComponentAdapterFactory caf)

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.