public class SetterInjectionComponentAdapter extends InstantiatingComponentAdapter
BeanPropertyComponentAdapter.
Note that this class doesn't cache instances. If you want caching,
use a CachingComponentAdapter around this one.
InstantiatingComponentAdapter.Guard| Modifier and Type | Field and Description |
|---|---|
private InstantiatingComponentAdapter.Guard |
instantiationGuard |
private java.util.List |
setterNames |
private java.util.List |
setters |
private java.lang.Class[] |
setterTypes |
allowNonPublicClasses, lifecycleStrategy, parameters, verifyingGuard| Constructor and Description |
|---|
SetterInjectionComponentAdapter(java.lang.Object componentKey,
java.lang.Class componentImplementation,
Parameter[] parameters)
Constructs a SetterInjectionComponentAdapter with key, implementation and parameters.
|
SetterInjectionComponentAdapter(java.lang.Object componentKey,
java.lang.Class componentImplementation,
Parameter[] parameters,
boolean allowNonPublicClasses)
Constructs a SetterInjectionComponentAdapter with a
DelegatingComponentMonitor as default. |
SetterInjectionComponentAdapter(java.lang.Object componentKey,
java.lang.Class componentImplementation,
Parameter[] parameters,
boolean allowNonPublicClasses,
ComponentMonitor monitor)
Constructs a SetterInjectionComponentAdapter
|
SetterInjectionComponentAdapter(java.lang.Object componentKey,
java.lang.Class componentImplementation,
Parameter[] parameters,
boolean allowNonPublicClasses,
ComponentMonitor monitor,
LifecycleStrategy lifecycleStrategy)
Constructs a SetterInjectionComponentAdapter
|
| Modifier and Type | Method and Description |
|---|---|
java.lang.Object |
getComponentInstance(PicoContainer container)
Retrieve the component instance.
|
private java.lang.reflect.Constructor |
getConstructor() |
protected java.lang.reflect.Constructor |
getGreediestSatisfiableConstructor(PicoContainer container)
Find and return the greediest satisfiable constructor.
|
private Parameter[] |
getMatchingParameterListForSetters(PicoContainer container) |
private java.lang.reflect.Method[] |
getMethods() |
private void |
initializeSetterAndTypeLists() |
void |
verify(PicoContainer container)
Verify that all dependencies for this adapter can be satisifed.
|
accept, createDefaultParameters, dispose, hasLifecycle, newInstance, start, stopcheckTypeCompatibility, getComponentImplementation, getComponentKey, toStringchangeMonitor, currentMonitorprivate transient InstantiatingComponentAdapter.Guard instantiationGuard
private transient java.util.List setters
private transient java.util.List setterNames
private transient java.lang.Class[] setterTypes
public SetterInjectionComponentAdapter(java.lang.Object componentKey,
java.lang.Class componentImplementation,
Parameter[] parameters,
boolean allowNonPublicClasses,
ComponentMonitor monitor,
LifecycleStrategy lifecycleStrategy)
throws AssignabilityRegistrationException,
NotConcreteRegistrationException
componentKey - the search key for this implementationcomponentImplementation - the concrete implementationparameters - the parameters to use for the initializationallowNonPublicClasses - flag to allow instantiation of non-public classes.monitor - the component monitor used by this adapterlifecycleStrategy - the component lifecycle strategy used by this adapterAssignabilityRegistrationException - if the key is a type and the implementation cannot be assigned to.NotConcreteRegistrationException - if the implementation is not a concrete class.java.lang.NullPointerException - if one of the parameters is nullpublic SetterInjectionComponentAdapter(java.lang.Object componentKey,
java.lang.Class componentImplementation,
Parameter[] parameters,
boolean allowNonPublicClasses,
ComponentMonitor monitor)
throws AssignabilityRegistrationException,
NotConcreteRegistrationException
componentKey - the search key for this implementationcomponentImplementation - the concrete implementationparameters - the parameters to use for the initializationallowNonPublicClasses - flag to allow instantiation of non-public classes.monitor - the component monitor used by this adapterAssignabilityRegistrationException - if the key is a type and the implementation cannot be assigned to.NotConcreteRegistrationException - if the implementation is not a concrete class.java.lang.NullPointerException - if one of the parameters is nullpublic SetterInjectionComponentAdapter(java.lang.Object componentKey,
java.lang.Class componentImplementation,
Parameter[] parameters,
boolean allowNonPublicClasses)
throws AssignabilityRegistrationException,
NotConcreteRegistrationException
DelegatingComponentMonitor as default.componentKey - the search key for this implementationcomponentImplementation - the concrete implementationparameters - the parameters to use for the initializationallowNonPublicClasses - flag to allow instantiation of non-public classes.AssignabilityRegistrationException - if the key is a type and the implementation cannot be assigned to.NotConcreteRegistrationException - if the implementation is not a concrete class.java.lang.NullPointerException - if one of the parameters is nullpublic SetterInjectionComponentAdapter(java.lang.Object componentKey,
java.lang.Class componentImplementation,
Parameter[] parameters)
throws AssignabilityRegistrationException,
NotConcreteRegistrationException
componentKey - the search key for this implementationcomponentImplementation - the concrete implementationparameters - the parameters to use for the initializationAssignabilityRegistrationException - if the key is a type and the implementation cannot be assigned to.NotConcreteRegistrationException - if the implementation is not a concrete class.java.lang.NullPointerException - if one of the parameters is nullprotected java.lang.reflect.Constructor getGreediestSatisfiableConstructor(PicoContainer container) throws PicoIntrospectionException, UnsatisfiableDependenciesException, AmbiguousComponentResolutionException, AssignabilityRegistrationException, NotConcreteRegistrationException
InstantiatingComponentAdaptergetGreediestSatisfiableConstructor in class InstantiatingComponentAdaptercontainer - the PicoContainer to resolve dependencies.PicoIntrospectionExceptionUnsatisfiableDependenciesExceptionAmbiguousComponentResolutionExceptionAssignabilityRegistrationExceptionNotConcreteRegistrationExceptionprivate java.lang.reflect.Constructor getConstructor()
throws PicoInvocationTargetInitializationException
private Parameter[] getMatchingParameterListForSetters(PicoContainer container) throws PicoInitializationException, UnsatisfiableDependenciesException
public java.lang.Object getComponentInstance(PicoContainer container) throws PicoInitializationException, PicoIntrospectionException, AssignabilityRegistrationException, NotConcreteRegistrationException
ComponentAdapterCachingComponentAdapter will always return the
same instance.container - the PicoContainer, that is used to resolve any possible dependencies of the instance.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.AssignabilityRegistrationExceptionNotConcreteRegistrationExceptionpublic void verify(PicoContainer container) throws PicoIntrospectionException
ComponentAdapterverify in interface ComponentAdapterverify in class InstantiatingComponentAdaptercontainer - the PicoContainer, that is used to resolve any possible dependencies of the instance.PicoIntrospectionException - if one or more dependencies cannot be resolved.private void initializeSetterAndTypeLists()
private java.lang.reflect.Method[] getMethods()