public class CompositeInjector<T> extends AbstractInjector<T>
AbstractInjector.AmbiguousComponentResolutionException, AbstractInjector.CyclicDependencyException, AbstractInjector.NotConcreteRegistrationException, AbstractInjector.UnsatisfiableDependenciesException
ComponentAdapter.NOTHING
parameters, verifyingGuard
Constructor and Description |
---|
CompositeInjector(Object componentKey,
Class<?> componentImplementation,
Parameter[] parameters,
ComponentMonitor monitor,
boolean useNames,
Injector... injectors) |
Modifier and Type | Method and Description |
---|---|
void |
accept(PicoVisitor visitor)
Accepts a visitor for this ComponentAdapter.
|
Object |
decorateComponentInstance(PicoContainer container,
Type into,
T instance)
A preexiting component instance can be injected into after instantiation
|
T |
getComponentInstance(PicoContainer container)
Retrieve the component instance.
|
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()
|
void |
verify(PicoContainer container)
Verify that all dependencies for this adapter can be satisfied.
|
box, caughtIllegalAccessException, caughtIllegalAccessException, caughtInstantiationException, caughtInvocationTargetException, createDefaultParameters, 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 CompositeInjector(Object componentKey, Class<?> componentImplementation, Parameter[] parameters, ComponentMonitor monitor, boolean useNames, Injector... injectors)
public T getComponentInstance(PicoContainer container) 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.PicoCompositionException
- if the component has dependencies which could not be resolved, or
instantiation of the component lead to an ambigous situation within the
container.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 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.public final void accept(PicoVisitor visitor)
ComponentAdapter
PicoContainer
, that
cascades the visitor also down to all its ComponentAdapter instances.accept
in interface ComponentAdapter<T>
accept
in class AbstractInjector<T>
visitor
- the visitor.public String getDescriptor()
ComponentAdapter
getDescriptor
in interface ComponentAdapter<T>
getDescriptor
in class AbstractInjector<T>
Copyright © 2003–2016 Codehaus. All rights reserved.