public class ConstructorInjectionComponentAdapter extends InstantiatingComponentAdapter
CachingComponentAdapter
around this one.
Modifier and Type | Class and Description |
---|---|
private static class |
ConstructorInjectionComponentAdapter.Guard |
Modifier and Type | Field and Description |
---|---|
private ConstructorInjectionComponentAdapter.Guard |
instantiationGuard |
private java.util.List |
sortedMatchingConstructors |
allowNonPublicClasses, lifecycleStrategy, parameters, verifyingGuard
Constructor and Description |
---|
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
|
Modifier and Type | Method and Description |
---|---|
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() |
accept, createDefaultParameters, dispose, hasLifecycle, newInstance, start, stop, verify
checkTypeCompatibility, getComponentImplementation, getComponentKey, toString
changeMonitor, currentMonitor
private transient java.util.List sortedMatchingConstructors
private transient ConstructorInjectionComponentAdapter.Guard instantiationGuard
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 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 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 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 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 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 null
public ConstructorInjectionComponentAdapter(java.lang.Object componentKey, java.lang.Class componentImplementation) throws AssignabilityRegistrationException, NotConcreteRegistrationException
componentKey
- the search key for this implementationcomponentImplementation
- the concrete implementationAssignabilityRegistrationException
- 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
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
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
protected java.lang.Object[] getConstructorArguments(PicoContainer container, java.lang.reflect.Constructor ctor)
private java.util.List getSortedMatchingConstructors()
private java.lang.reflect.Constructor[] getConstructors()