org.picocontainer.defaults
Class ConstructorInjectionComponentAdapter
java.lang.Object
org.picocontainer.defaults.AbstractComponentAdapter
org.picocontainer.defaults.InstantiatingComponentAdapter
org.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.29 $
- Author:
- Paul Hammant, Aslak Hellesøy, Jon Tirsén, Zohar Melamed, Jörg Schaible
- See Also:
- Serialized Form
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.
getGreediestSatisfiableConstructor
protected Constructor getGreediestSatisfiableConstructor(PicoContainer container)
throws PicoIntrospectionException,
UnsatisfiableDependenciesException,
AmbiguousComponentResolutionException,
AssignabilityRegistrationException,
NotConcreteRegistrationException
- Description copied from class:
InstantiatingComponentAdapter
- Find and return the greediest satisfiable constructor.
- Specified by:
getGreediestSatisfiableConstructor
in class InstantiatingComponentAdapter
- Parameters:
container
- the PicoContainer to resolve dependencies.
- Returns:
- the found constructor.
- Throws:
AmbiguousComponentResolutionException
UnsatisfiableDependenciesException
NotConcreteRegistrationException
PicoIntrospectionException
AssignabilityRegistrationException
getComponentInstance
public Object getComponentInstance(PicoContainer container)
throws PicoInitializationException,
PicoIntrospectionException,
AssignabilityRegistrationException,
NotConcreteRegistrationException
- Description copied from interface:
ComponentAdapter
- Retrieve the component instance. This method will usually create a new instance each time it is called, but that
is not required. For example,
CachingComponentAdapter
will always return the
same instance.
- Parameters:
container
- the PicoContainer
, that is used to resolve any possible dependencies of the instance.
- Returns:
- the component instance.
- Throws:
PicoIntrospectionException
- if the component has dependencies which could not be resolved, or
instantiation of the component lead to an ambigous situation within the
container.
PicoInitializationException
- if the component could not be instantiated.
AssignabilityRegistrationException
NotConcreteRegistrationException
getConstructorArguments
protected Object[] getConstructorArguments(PicoContainer container,
Constructor ctor)
Copyright © 2003-2004 Codehaus. All Rights Reserved.