org.picocontainer.defaults
Class SetterInjectionComponentAdapter
java.lang.Object
org.picocontainer.defaults.AbstractComponentAdapter
org.picocontainer.defaults.InstantiatingComponentAdapter
org.picocontainer.defaults.SetterInjectionComponentAdapter
- All Implemented Interfaces:
- ComponentAdapter, Serializable
- public class SetterInjectionComponentAdapter
- extends InstantiatingComponentAdapter
Instantiates components using empty constructors and
Setter Injection.
For easy setting of primitive properties, also see BeanPropertyComponentAdapter
.
Note that this class doesn't cache instances. If you want caching,
use a CachingComponentAdapter
around this one.
- Version:
- $Revision: 1820 $
- Author:
- Aslak Hellesøy, Jörg Schaible
- See Also:
- Serialized Form
SetterInjectionComponentAdapter
public SetterInjectionComponentAdapter(Object componentKey,
Class componentImplementation,
Parameter[] parameters,
boolean allowNonPublicClasses)
throws AssignabilityRegistrationException,
NotConcreteRegistrationException
- {@inheritDoc}
Explicitly specifies parameters, if null uses default parameters.
SetterInjectionComponentAdapter
public SetterInjectionComponentAdapter(Object componentKey,
Class componentImplementation,
Parameter[] parameters)
throws AssignabilityRegistrationException,
NotConcreteRegistrationException
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:
NotConcreteRegistrationException
UnsatisfiableDependenciesException
PicoIntrospectionException
AssignabilityRegistrationException
AmbiguousComponentResolutionException
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:
PicoInitializationException
- if the component could not be instantiated.
PicoIntrospectionException
- if the component has dependencies which could not be resolved, or
instantiation of the component lead to an ambigous situation within the
container.
AssignabilityRegistrationException
NotConcreteRegistrationException
verify
public void verify(PicoContainer container)
throws PicoIntrospectionException
- Description copied from interface:
ComponentAdapter
- Verify that all dependencies for this adapter can be satisifed. Normally, the adapter should verify this by
checking that the associated PicoContainer contains all the needed dependnecies.
- Specified by:
verify
in interface ComponentAdapter
- Overrides:
verify
in class InstantiatingComponentAdapter
- Throws:
PicoIntrospectionException
Copyright © 2003-2005 Codehaus. All Rights Reserved.