public abstract class MethodInjector<T> extends SingleMemberInjector<T>
Modifier and Type | Class and Description |
---|---|
static class |
MethodInjector.ByMethodName |
static class |
MethodInjector.ByReflectionMethod |
SingleMemberInjector.ParameterCannotBeNullException
AbstractInjector.AmbiguousComponentResolutionException, AbstractInjector.CyclicDependencyException, AbstractInjector.NotConcreteRegistrationException, AbstractInjector.UnsatisfiableDependenciesException
ComponentAdapter.NOTHING
parameters, verifyingGuard
Constructor and Description |
---|
MethodInjector(Object componentKey,
Class componentImplementation,
Parameter[] parameters,
ComponentMonitor monitor,
String methodName,
boolean useNames)
Creates a MethodInjector
|
Modifier and Type | Method and Description |
---|---|
Object |
decorateComponentInstance(PicoContainer container,
Type into,
T instance)
A preexiting component instance can be injected into after instantiation
|
T |
getComponentInstance(PicoContainer container,
Type into)
Retrieve the component instance.
|
protected abstract Method |
getInjectorMethod() |
protected Object[] |
getMemberArguments(PicoContainer container,
Method method) |
protected boolean |
isNullParamAllowed(AccessibleObject member,
int i)
Checks to see if a null parameter is allowed in the given
constructor/field/method.
|
void |
verify(PicoContainer container)
Verify that all dependencies for this adapter can be satisfied.
|
boxParameters, getBindings, getMemberArguments, getParameter, getParanamer, nullCheck
accept, box, caughtIllegalAccessException, caughtIllegalAccessException, caughtInstantiationException, caughtInvocationTargetException, createDefaultParameters, getComponentInstance, getDescriptor, 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 MethodInjector(Object componentKey, Class componentImplementation, Parameter[] parameters, ComponentMonitor monitor, String methodName, 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 addAdaptermethodName
- the method nameuseNames
- use argument names when looking up dependenciesAbstractInjector.NotConcreteRegistrationException
- if the implementation is not a concrete class.NullPointerException
- if one of the parameters is null
protected abstract Method getInjectorMethod()
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.protected Object[] getMemberArguments(PicoContainer container, Method method)
public Object decorateComponentInstance(PicoContainer container, Type into, T instance)
Injector
decorateComponentInstance
in interface Injector<T>
decorateComponentInstance
in class AbstractInjector<T>
container
- the container that can provide injectable dependenciesinstance
- the instance topublic 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.protected boolean isNullParamAllowed(AccessibleObject member, int i)
SingleMemberInjector
isNullParamAllowed
in class SingleMemberInjector<T>
member
- constructor method or fieldi
- parameter #.Copyright © 2003–2015 Codehaus. All rights reserved.