|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.picocontainer.defaults.MonitoringComponentAdapter
org.picocontainer.defaults.AbstractComponentAdapter
org.picocontainer.defaults.InstantiatingComponentAdapter
org.picocontainer.defaults.SetterInjectionComponentAdapter
public class SetterInjectionComponentAdapter
Instantiates components using empty constructors and
Setter Injection.
For easy setting of primitive properties, also see BeanPropertyComponentAdapter
.
CachingComponentAdapter
around this one.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class org.picocontainer.defaults.InstantiatingComponentAdapter |
---|
InstantiatingComponentAdapter.Guard |
Field Summary | |
---|---|
private InstantiatingComponentAdapter.Guard |
instantiationGuard
|
private java.util.List |
setterNames
|
private java.util.List |
setters
|
private java.lang.Class[] |
setterTypes
|
Fields inherited from class org.picocontainer.defaults.InstantiatingComponentAdapter |
---|
allowNonPublicClasses, lifecycleStrategy, parameters, verifyingGuard |
Constructor Summary | |
---|---|
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 |
Method Summary | |
---|---|
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. |
Methods inherited from class org.picocontainer.defaults.InstantiatingComponentAdapter |
---|
accept, createDefaultParameters, dispose, hasLifecycle, newInstance, start, stop |
Methods inherited from class org.picocontainer.defaults.AbstractComponentAdapter |
---|
checkTypeCompatibility, getComponentImplementation, getComponentKey, toString |
Methods inherited from class org.picocontainer.defaults.MonitoringComponentAdapter |
---|
changeMonitor, currentMonitor |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private transient InstantiatingComponentAdapter.Guard instantiationGuard
private transient java.util.List setters
private transient java.util.List setterNames
private transient java.lang.Class[] setterTypes
Constructor Detail |
---|
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 adapter
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 null
public 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 adapter
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 null
public 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 null
public 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 initialization
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 null
Method Detail |
---|
protected java.lang.reflect.Constructor getGreediestSatisfiableConstructor(PicoContainer container) throws PicoIntrospectionException, UnsatisfiableDependenciesException, AmbiguousComponentResolutionException, AssignabilityRegistrationException, NotConcreteRegistrationException
InstantiatingComponentAdapter
getGreediestSatisfiableConstructor
in class InstantiatingComponentAdapter
container
- the PicoContainer to resolve dependencies.
PicoIntrospectionException
UnsatisfiableDependenciesException
AmbiguousComponentResolutionException
AssignabilityRegistrationException
NotConcreteRegistrationException
private java.lang.reflect.Constructor getConstructor() throws PicoInvocationTargetInitializationException
PicoInvocationTargetInitializationException
private Parameter[] getMatchingParameterListForSetters(PicoContainer container) throws PicoInitializationException, UnsatisfiableDependenciesException
PicoInitializationException
UnsatisfiableDependenciesException
public java.lang.Object getComponentInstance(PicoContainer container) throws PicoInitializationException, PicoIntrospectionException, AssignabilityRegistrationException, NotConcreteRegistrationException
ComponentAdapter
CachingComponentAdapter
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.
AssignabilityRegistrationException
NotConcreteRegistrationException
public void verify(PicoContainer container) throws PicoIntrospectionException
ComponentAdapter
verify
in interface ComponentAdapter
verify
in class InstantiatingComponentAdapter
container
- 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()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |