org.picocontainer.defaults
Class ConstructorInjectionComponentAdapter

java.lang.Object
  extended byorg.picocontainer.defaults.AbstractComponentAdapter
      extended byorg.picocontainer.defaults.InstantiatingComponentAdapter
          extended byorg.picocontainer.defaults.ConstructorInjectionComponentAdapter
All Implemented Interfaces:
ComponentAdapter, Serializable

public class ConstructorInjectionComponentAdapter
extends InstantiatingComponentAdapter

Instantiates components using Constructor Injection.

Note that this class doesn't cache instances. If you want caching, use a CachingComponentAdapter around this one.

Version:
$Revision: 1.13 $
Author:
Paul Hammant, Aslak Hellesøy, Jon Tirsén, Zohar Melamed, Jörg Schaible
See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.picocontainer.defaults.InstantiatingComponentAdapter
parameters
 
Constructor Summary
ConstructorInjectionComponentAdapter(Object componentKey, Class componentImplementation)
          Use default parameters.
ConstructorInjectionComponentAdapter(Object componentKey, Class componentImplementation, Parameter[] parameters)
           
ConstructorInjectionComponentAdapter(Object componentKey, Class componentImplementation, Parameter[] parameters, boolean allowNonPublicClasses)
          Explicitly specifies parameters.
 
Method Summary
protected  Object[] getConstructorArguments(List adapterDependencies)
           
protected  Constructor getGreediestSatisifableConstructor(List adapterInstantiationOrderTrackingList)
           
protected  Object instantiateComponent(List adapterInstantiationOrderTrackingList)
          Instantiate the object.
 
Methods inherited from class org.picocontainer.defaults.InstantiatingComponentAdapter
createDefaultParameters, getComponentInstance, newInstance, verify
 
Methods inherited from class org.picocontainer.defaults.AbstractComponentAdapter
getComponentImplementation, getComponentKey, getContainer, setContainer, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ConstructorInjectionComponentAdapter

public ConstructorInjectionComponentAdapter(Object componentKey,
                                            Class componentImplementation,
                                            Parameter[] parameters,
                                            boolean allowNonPublicClasses)
                                     throws AssignabilityRegistrationException,
                                            NotConcreteRegistrationException
Explicitly specifies parameters. If parameters are null, default parameters will be used.


ConstructorInjectionComponentAdapter

public ConstructorInjectionComponentAdapter(Object componentKey,
                                            Class componentImplementation,
                                            Parameter[] parameters)

ConstructorInjectionComponentAdapter

public ConstructorInjectionComponentAdapter(Object componentKey,
                                            Class componentImplementation)
                                     throws AssignabilityRegistrationException,
                                            NotConcreteRegistrationException
Use default parameters.

Method Detail

getGreediestSatisifableConstructor

protected Constructor getGreediestSatisifableConstructor(List adapterInstantiationOrderTrackingList)
                                                  throws PicoIntrospectionException,
                                                         UnsatisfiableDependenciesException,
                                                         AmbiguousComponentResolutionException,
                                                         AssignabilityRegistrationException,
                                                         NotConcreteRegistrationException
Specified by:
getGreediestSatisifableConstructor in class InstantiatingComponentAdapter
Throws:
PicoIntrospectionException
UnsatisfiableDependenciesException
AmbiguousComponentResolutionException
AssignabilityRegistrationException
NotConcreteRegistrationException

instantiateComponent

protected Object instantiateComponent(List adapterInstantiationOrderTrackingList)
                               throws PicoInitializationException,
                                      PicoIntrospectionException,
                                      AssignabilityRegistrationException,
                                      NotConcreteRegistrationException
Description copied from class: InstantiatingComponentAdapter
Instantiate the object.

Specified by:
instantiateComponent in class InstantiatingComponentAdapter
Parameters:
adapterInstantiationOrderTrackingList - This list is filled with the dependent adapters of the instance.
Returns:
Returns the new instance.
Throws:
PicoInitializationException
AssignabilityRegistrationException
NotConcreteRegistrationException
PicoIntrospectionException

getConstructorArguments

protected Object[] getConstructorArguments(List adapterDependencies)


Copyright © 2003-2004 Codehaus. All Rights Reserved.