|
||||||||||
| 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.ConstructorInjectionComponentAdapter
public class ConstructorInjectionComponentAdapter
Instantiates components using Constructor Injection.
Note that this class doesn't cache instances. If you want caching,
use a CachingComponentAdapter around this one.
| Nested Class Summary | |
|---|---|
private static class |
ConstructorInjectionComponentAdapter.Guard
|
| Field Summary | |
|---|---|
private ConstructorInjectionComponentAdapter.Guard |
instantiationGuard
|
private java.util.List |
sortedMatchingConstructors
|
| Fields inherited from class org.picocontainer.defaults.InstantiatingComponentAdapter |
|---|
allowNonPublicClasses, lifecycleStrategy, parameters, verifyingGuard |
| Constructor Summary | |
|---|---|
ConstructorInjectionComponentAdapter(java.lang.Object componentKey,
java.lang.Class componentImplementation)
Creates a ConstructorInjectionComponentAdapter with key and implementation |
|
ConstructorInjectionComponentAdapter(java.lang.Object componentKey,
java.lang.Class componentImplementation,
Parameter[] parameters)
Creates a ConstructorInjectionComponentAdapter with key, implementation and parameters |
|
ConstructorInjectionComponentAdapter(java.lang.Object componentKey,
java.lang.Class componentImplementation,
Parameter[] parameters,
boolean allowNonPublicClasses)
Creates a ConstructorInjectionComponentAdapter |
|
ConstructorInjectionComponentAdapter(java.lang.Object componentKey,
java.lang.Class componentImplementation,
Parameter[] parameters,
boolean allowNonPublicClasses,
ComponentMonitor monitor)
Creates a ConstructorInjectionComponentAdapter |
|
ConstructorInjectionComponentAdapter(java.lang.Object componentKey,
java.lang.Class componentImplementation,
Parameter[] parameters,
boolean allowNonPublicClasses,
ComponentMonitor monitor,
LifecycleStrategy lifecycleStrategy)
Creates a ConstructorInjectionComponentAdapter |
|
| Method Summary | |
|---|---|
java.lang.Object |
getComponentInstance(PicoContainer container)
Retrieve the component instance. |
protected java.lang.Object[] |
getConstructorArguments(PicoContainer container,
java.lang.reflect.Constructor ctor)
|
private java.lang.reflect.Constructor[] |
getConstructors()
|
protected java.lang.reflect.Constructor |
getGreediestSatisfiableConstructor(PicoContainer container)
Find and return the greediest satisfiable constructor. |
private java.util.List |
getSortedMatchingConstructors()
|
| Methods inherited from class org.picocontainer.defaults.InstantiatingComponentAdapter |
|---|
accept, createDefaultParameters, dispose, hasLifecycle, newInstance, start, stop, verify |
| 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 java.util.List sortedMatchingConstructors
private transient ConstructorInjectionComponentAdapter.Guard instantiationGuard
| Constructor Detail |
|---|
public ConstructorInjectionComponentAdapter(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 ConstructorInjectionComponentAdapter(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 ConstructorInjectionComponentAdapter(java.lang.Object componentKey,
java.lang.Class componentImplementation,
Parameter[] parameters,
boolean allowNonPublicClasses)
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.
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 ConstructorInjectionComponentAdapter(java.lang.Object componentKey,
java.lang.Class componentImplementation,
Parameter[] parameters)
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
public ConstructorInjectionComponentAdapter(java.lang.Object componentKey,
java.lang.Class componentImplementation)
throws AssignabilityRegistrationException,
NotConcreteRegistrationException
componentKey - the search key for this implementationcomponentImplementation - the concrete implementation
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 InstantiatingComponentAdaptercontainer - the PicoContainer to resolve dependencies.
PicoIntrospectionException
UnsatisfiableDependenciesException
AmbiguousComponentResolutionException
AssignabilityRegistrationException
NotConcreteRegistrationException
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.
AssignabilityRegistrationException
NotConcreteRegistrationException
protected java.lang.Object[] getConstructorArguments(PicoContainer container,
java.lang.reflect.Constructor ctor)
private java.util.List getSortedMatchingConstructors()
private java.lang.reflect.Constructor[] getConstructors()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||