public class ConstructorInjector<T> extends SingleMemberInjector<T>
Modifier and Type | Class and Description |
---|---|
protected class |
ConstructorInjector.CtorAndAdapters<TYPE> |
SingleMemberInjector.ParameterCannotBeNullException
AbstractInjector.AmbiguousComponentResolutionException, AbstractInjector.CyclicDependencyException, AbstractInjector.NotConcreteRegistrationException, AbstractInjector.UnsatisfiableDependenciesException
ComponentAdapter.NOTHING
parameters, verifyingGuard
Constructor and Description |
---|
ConstructorInjector(Object componentKey,
Class<?> componentImplementation,
Parameter... parameters)
Constructor injector that uses no monitor and no lifecycle adapter.
|
ConstructorInjector(Object componentKey,
Class componentImplementation,
Parameter[] parameters,
ComponentMonitor monitor,
boolean useNames)
Creates a ConstructorInjector
|
ConstructorInjector(Object componentKey,
Class componentImplementation,
Parameter[] parameters,
ComponentMonitor monitor,
boolean useNames,
boolean rememberChosenCtor)
Creates a ConstructorInjector
|
Modifier and Type | Method and Description |
---|---|
void |
enableEmjection(boolean enableEmjection) |
T |
getComponentInstance(PicoContainer container,
Type into)
Retrieve the component instance.
|
String |
getDescriptor()
Get a string key descriptor of the component adapter for use in toString()
|
protected ConstructorInjector.CtorAndAdapters<T> |
getGreediestSatisfiableConstructor(PicoContainer container) |
void |
verify(PicoContainer container)
Verify that all dependencies for this adapter can be satisfied.
|
ConstructorInjector<T> |
withNonPublicConstructors() |
boxParameters, getBindings, getMemberArguments, getParameter, getParanamer, isNullParamAllowed, nullCheck
accept, box, caughtIllegalAccessException, caughtIllegalAccessException, caughtInstantiationException, caughtInvocationTargetException, createDefaultParameters, decorateComponentInstance, getComponentInstance, newInstance, useNames
changeMonitor, checkTypeCompatibility, currentMonitor, findAdapterOfType, getComponentImplementation, getComponentKey, getDelegate, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
findAdapterOfType, getComponentImplementation, getComponentKey, getDelegate
public ConstructorInjector(Object componentKey, Class<?> componentImplementation, Parameter... parameters)
componentKey
- the search key for this implementationcomponentImplementation
- the concrete implementationparameters
- the parameters used for initializationpublic ConstructorInjector(Object componentKey, Class componentImplementation, Parameter[] parameters, ComponentMonitor monitor, boolean useNames) throws AbstractInjector.NotConcreteRegistrationException
componentKey
- the search key for this implementationcomponentImplementation
- the concrete implementationparameters
- the parameters to use for the initializationmonitor
- the component monitor used by this addAdapteruseNames
- use argument names when looking up dependenciesAbstractInjector.NotConcreteRegistrationException
- if the implementation is not a concrete class.NullPointerException
- if one of the parameters is null
public ConstructorInjector(Object componentKey, Class componentImplementation, Parameter[] parameters, ComponentMonitor monitor, boolean useNames, boolean rememberChosenCtor) throws AbstractInjector.NotConcreteRegistrationException
componentKey
- the search key for this implementationcomponentImplementation
- the concrete implementationparameters
- the parameters to use for the initializationmonitor
- the component monitor used by this addAdapteruseNames
- use argument names when looking up dependenciesrememberChosenCtor
- remember the chosen constructor (to speed up second/subsequent calls)AbstractInjector.NotConcreteRegistrationException
- if the implementation is not a concrete class.NullPointerException
- if one of the parameters is null
protected ConstructorInjector.CtorAndAdapters<T> getGreediestSatisfiableConstructor(PicoContainer container) throws PicoCompositionException
PicoCompositionException
public void enableEmjection(boolean enableEmjection)
public ConstructorInjector<T> withNonPublicConstructors()
public T getComponentInstance(PicoContainer container, Type into) throws PicoCompositionException
ComponentAdapter
Cached
will always return the
same instance.getComponentInstance
in interface ComponentAdapter<T>
getComponentInstance
in class AbstractInjector<T>
container
- the PicoContainer
, that is used to resolve any possible dependencies of the instance.into
- the class that is about to be injected into. Use ComponentAdapter.NOTHING.class if this is not important to you.PicoCompositionException
- if the component has dependencies which could not be resolved, or
instantiation of the component lead to an ambiguous situation within the
container.public void verify(PicoContainer container) throws PicoCompositionException
ComponentAdapter
verify
in interface ComponentAdapter<T>
verify
in class AbstractInjector<T>
container
- the PicoContainer
, that is used to resolve any possible dependencies of the instance.PicoCompositionException
- if one or more dependencies cannot be resolved.public String getDescriptor()
ComponentAdapter
getDescriptor
in interface ComponentAdapter<T>
getDescriptor
in class AbstractInjector<T>
Copyright © 2003–2016 Codehaus. All rights reserved.