com.jdon.container.pico
Class JdonPicoContainer

java.lang.Object
  extended by com.jdon.container.pico.JdonPicoContainer
All Implemented Interfaces:
java.io.Serializable, org.picocontainer.Disposable, org.picocontainer.MutablePicoContainer, org.picocontainer.PicoContainer, org.picocontainer.Startable

public class JdonPicoContainer
extends java.lang.Object
implements org.picocontainer.MutablePicoContainer, java.io.Serializable

modify the method getComponentInstance of DefaultPicoContainer of picocontainer

See Also:
Serialized Form

Field Summary
static java.lang.String module
           
 
Constructor Summary
JdonPicoContainer()
          Creates a new container with a (caching) DefaultComponentAdapterFactory and no parent container.
JdonPicoContainer(org.picocontainer.defaults.ComponentAdapterFactory componentAdapterFactory)
          Creates a new container with a custom ComponentAdapterFactory and no parent container.
JdonPicoContainer(org.picocontainer.defaults.ComponentAdapterFactory componentAdapterFactory, org.picocontainer.PicoContainer parent)
          Creates a new container with a custom ComponentAdapterFactory and a parent container.
JdonPicoContainer(org.picocontainer.PicoContainer parent)
          Creates a new container with a (caching) DefaultComponentAdapterFactory and a parent container.
 
Method Summary
 void accept(org.picocontainer.PicoVisitor visitor)
           
 boolean addChildContainer(org.picocontainer.PicoContainer child)
           
 void dispose()
          Dispose the components of this PicoContainer and all its logical child containers.
 org.picocontainer.ComponentAdapter getComponentAdapter(java.lang.Object componentKey)
           
 org.picocontainer.ComponentAdapter getComponentAdapterOfType(java.lang.Class componentType)
           
 java.util.Collection getComponentAdapters()
           
 java.util.List getComponentAdaptersOfType(java.lang.Class componentType)
           
 java.lang.Object getComponentInstance(java.lang.Object componentKey)
           
 java.lang.Object getComponentInstanceOfType(java.lang.Class componentType)
           
 java.util.List getComponentInstances()
           
 java.util.List getComponentInstancesOfType(java.lang.Class componentType)
           
 java.lang.Object getInstance(org.picocontainer.ComponentAdapter componentAdapter)
          modify this method of old DefaultPicocontainer
 org.picocontainer.PicoContainer getParent()
           
 org.picocontainer.MutablePicoContainer makeChildContainer()
           
 org.picocontainer.ComponentAdapter registerComponent(org.picocontainer.ComponentAdapter componentAdapter)
           This method can be used to override the ComponentAdapter created by the ComponentAdapterFactory passed to the constructor of this container.
 org.picocontainer.ComponentAdapter registerComponentImplementation(java.lang.Class componentImplementation)
           The returned ComponentAdapter will be instantiated by the ComponentAdapterFactory passed to the container's constructor.
 org.picocontainer.ComponentAdapter registerComponentImplementation(java.lang.Object componentKey, java.lang.Class componentImplementation)
           The returned ComponentAdapter will be instantiated by the ComponentAdapterFactory passed to the container's constructor.
 org.picocontainer.ComponentAdapter registerComponentImplementation(java.lang.Object componentKey, java.lang.Class componentImplementation, java.util.List parameters)
          Same as registerComponentImplementation(java.lang.Object, java.lang.Class, org.picocontainer.Parameter[]) but with parameters as a List.
 org.picocontainer.ComponentAdapter registerComponentImplementation(java.lang.Object componentKey, java.lang.Class componentImplementation, org.picocontainer.Parameter[] parameters)
           The returned ComponentAdapter will be instantiated by the ComponentAdapterFactory passed to the container's constructor.
 org.picocontainer.ComponentAdapter registerComponentInstance(java.lang.Object component)
           The returned ComponentAdapter will be an InstanceComponentAdapter.
 org.picocontainer.ComponentAdapter registerComponentInstance(java.lang.Object componentKey, java.lang.Object componentInstance)
           The returned ComponentAdapter will be an InstanceComponentAdapter.
 boolean removeChildContainer(org.picocontainer.PicoContainer child)
           
 void start()
          Start the components of this PicoContainer and all its logical child containers.
 void stop()
          Stop the components of this PicoContainer and all its logical child containers.
 org.picocontainer.ComponentAdapter unregisterComponent(java.lang.Object componentKey)
           
 org.picocontainer.ComponentAdapter unregisterComponentByInstance(java.lang.Object componentInstance)
           
 void verify()
          Deprecated. since 1.1 - Use new VerifyingVisitor().traverse(this)
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

module

public static final java.lang.String module
Constructor Detail

JdonPicoContainer

public JdonPicoContainer(org.picocontainer.defaults.ComponentAdapterFactory componentAdapterFactory,
                         org.picocontainer.PicoContainer parent)
Creates a new container with a custom ComponentAdapterFactory and a parent container.

Important note about caching: If you intend the components to be cached, you should pass in a factory that creates CachingComponentAdapter instances, such as for example CachingComponentAdapterFactory. CachingComponentAdapterFactory can delegate to other ComponentAdapterFactories.

Parameters:
componentAdapterFactory - the factory to use for creation of ComponentAdapters.
parent - the parent container (used for component dependency lookups).

JdonPicoContainer

public JdonPicoContainer(org.picocontainer.PicoContainer parent)
Creates a new container with a (caching) DefaultComponentAdapterFactory and a parent container.


JdonPicoContainer

public JdonPicoContainer(org.picocontainer.defaults.ComponentAdapterFactory componentAdapterFactory)
Creates a new container with a custom ComponentAdapterFactory and no parent container.

Parameters:
componentAdapterFactory - the ComponentAdapterFactory to use.

JdonPicoContainer

public JdonPicoContainer()
Creates a new container with a (caching) DefaultComponentAdapterFactory and no parent container.

Method Detail

getComponentAdapters

public java.util.Collection getComponentAdapters()
Specified by:
getComponentAdapters in interface org.picocontainer.PicoContainer

getComponentAdapter

public final org.picocontainer.ComponentAdapter getComponentAdapter(java.lang.Object componentKey)
                                                             throws org.picocontainer.defaults.AmbiguousComponentResolutionException
Specified by:
getComponentAdapter in interface org.picocontainer.PicoContainer
Throws:
org.picocontainer.defaults.AmbiguousComponentResolutionException

getComponentAdapterOfType

public org.picocontainer.ComponentAdapter getComponentAdapterOfType(java.lang.Class componentType)
Specified by:
getComponentAdapterOfType in interface org.picocontainer.PicoContainer

getComponentAdaptersOfType

public java.util.List getComponentAdaptersOfType(java.lang.Class componentType)
Specified by:
getComponentAdaptersOfType in interface org.picocontainer.PicoContainer

registerComponent

public org.picocontainer.ComponentAdapter registerComponent(org.picocontainer.ComponentAdapter componentAdapter)
                                                     throws org.picocontainer.defaults.DuplicateComponentKeyRegistrationException
This method can be used to override the ComponentAdapter created by the ComponentAdapterFactory passed to the constructor of this container.

Specified by:
registerComponent in interface org.picocontainer.MutablePicoContainer
Throws:
org.picocontainer.defaults.DuplicateComponentKeyRegistrationException

unregisterComponent

public org.picocontainer.ComponentAdapter unregisterComponent(java.lang.Object componentKey)
Specified by:
unregisterComponent in interface org.picocontainer.MutablePicoContainer

registerComponentInstance

public org.picocontainer.ComponentAdapter registerComponentInstance(java.lang.Object component)
                                                             throws org.picocontainer.PicoRegistrationException
The returned ComponentAdapter will be an InstanceComponentAdapter.

Specified by:
registerComponentInstance in interface org.picocontainer.MutablePicoContainer
Throws:
org.picocontainer.PicoRegistrationException

registerComponentInstance

public org.picocontainer.ComponentAdapter registerComponentInstance(java.lang.Object componentKey,
                                                                    java.lang.Object componentInstance)
                                                             throws org.picocontainer.PicoRegistrationException
The returned ComponentAdapter will be an InstanceComponentAdapter.

Specified by:
registerComponentInstance in interface org.picocontainer.MutablePicoContainer
Throws:
org.picocontainer.PicoRegistrationException

registerComponentImplementation

public org.picocontainer.ComponentAdapter registerComponentImplementation(java.lang.Class componentImplementation)
                                                                   throws org.picocontainer.PicoRegistrationException
The returned ComponentAdapter will be instantiated by the ComponentAdapterFactory passed to the container's constructor.

Specified by:
registerComponentImplementation in interface org.picocontainer.MutablePicoContainer
Throws:
org.picocontainer.PicoRegistrationException

registerComponentImplementation

public org.picocontainer.ComponentAdapter registerComponentImplementation(java.lang.Object componentKey,
                                                                          java.lang.Class componentImplementation)
                                                                   throws org.picocontainer.PicoRegistrationException
The returned ComponentAdapter will be instantiated by the ComponentAdapterFactory passed to the container's constructor.

Specified by:
registerComponentImplementation in interface org.picocontainer.MutablePicoContainer
Throws:
org.picocontainer.PicoRegistrationException

registerComponentImplementation

public org.picocontainer.ComponentAdapter registerComponentImplementation(java.lang.Object componentKey,
                                                                          java.lang.Class componentImplementation,
                                                                          org.picocontainer.Parameter[] parameters)
                                                                   throws org.picocontainer.PicoRegistrationException
The returned ComponentAdapter will be instantiated by the ComponentAdapterFactory passed to the container's constructor.

Specified by:
registerComponentImplementation in interface org.picocontainer.MutablePicoContainer
Throws:
org.picocontainer.PicoRegistrationException

registerComponentImplementation

public org.picocontainer.ComponentAdapter registerComponentImplementation(java.lang.Object componentKey,
                                                                          java.lang.Class componentImplementation,
                                                                          java.util.List parameters)
                                                                   throws org.picocontainer.PicoRegistrationException
Same as registerComponentImplementation(java.lang.Object, java.lang.Class, org.picocontainer.Parameter[]) but with parameters as a List. Makes it possible to use with Groovy arrays (which are actually Lists).

Throws:
org.picocontainer.PicoRegistrationException

getComponentInstances

public java.util.List getComponentInstances()
                                     throws org.picocontainer.PicoException
Specified by:
getComponentInstances in interface org.picocontainer.PicoContainer
Throws:
org.picocontainer.PicoException

getComponentInstancesOfType

public java.util.List getComponentInstancesOfType(java.lang.Class componentType)
                                           throws org.picocontainer.PicoException
Specified by:
getComponentInstancesOfType in interface org.picocontainer.PicoContainer
Throws:
org.picocontainer.PicoException

getComponentInstance

public java.lang.Object getComponentInstance(java.lang.Object componentKey)
                                      throws org.picocontainer.PicoException
Specified by:
getComponentInstance in interface org.picocontainer.PicoContainer
Throws:
org.picocontainer.PicoException

getComponentInstanceOfType

public java.lang.Object getComponentInstanceOfType(java.lang.Class componentType)
Specified by:
getComponentInstanceOfType in interface org.picocontainer.PicoContainer

getInstance

public java.lang.Object getInstance(org.picocontainer.ComponentAdapter componentAdapter)
modify this method of old DefaultPicocontainer

Parameters:
componentAdapter -
Returns:

getParent

public org.picocontainer.PicoContainer getParent()
Specified by:
getParent in interface org.picocontainer.PicoContainer

unregisterComponentByInstance

public org.picocontainer.ComponentAdapter unregisterComponentByInstance(java.lang.Object componentInstance)
Specified by:
unregisterComponentByInstance in interface org.picocontainer.MutablePicoContainer

verify

public void verify()
            throws org.picocontainer.PicoVerificationException
Deprecated. since 1.1 - Use new VerifyingVisitor().traverse(this)

Specified by:
verify in interface org.picocontainer.PicoContainer
Throws:
org.picocontainer.PicoVerificationException

start

public void start()
Start the components of this PicoContainer and all its logical child containers. Any component implementing the lifecycle interface Startable will be started.

Specified by:
start in interface org.picocontainer.Startable
See Also:
makeChildContainer(), addChildContainer(PicoContainer), removeChildContainer(PicoContainer)

stop

public void stop()
Stop the components of this PicoContainer and all its logical child containers. Any component implementing the lifecycle interface Startable will be stopped.

Specified by:
stop in interface org.picocontainer.Startable
See Also:
makeChildContainer(), addChildContainer(PicoContainer), removeChildContainer(PicoContainer)

dispose

public void dispose()
Dispose the components of this PicoContainer and all its logical child containers. Any component implementing the lifecycle interface Disposable will be disposed.

Specified by:
dispose in interface org.picocontainer.Disposable
See Also:
makeChildContainer(), addChildContainer(PicoContainer), removeChildContainer(PicoContainer)

makeChildContainer

public org.picocontainer.MutablePicoContainer makeChildContainer()
Specified by:
makeChildContainer in interface org.picocontainer.MutablePicoContainer

addChildContainer

public boolean addChildContainer(org.picocontainer.PicoContainer child)
Specified by:
addChildContainer in interface org.picocontainer.MutablePicoContainer

removeChildContainer

public boolean removeChildContainer(org.picocontainer.PicoContainer child)
Specified by:
removeChildContainer in interface org.picocontainer.MutablePicoContainer

accept

public void accept(org.picocontainer.PicoVisitor visitor)
Specified by:
accept in interface org.picocontainer.PicoContainer