|
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.picocontainer.injectors.ProviderAdapter
public class ProviderAdapter
Providers are a type of Injector that can participate in Injection via a custom method. Implementors of this class must implement a single method called provide. That method must return the component type intended to be provided. The method can accept parameters that PicoContainer will satisfy.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface org.picocontainer.ComponentAdapter |
|---|
ComponentAdapter.NOTHING |
| Constructor Summary | |
|---|---|
protected |
ProviderAdapter()
|
|
ProviderAdapter(Object provider)
|
|
ProviderAdapter(Object provider,
boolean useNames)
|
| Method Summary | |
|---|---|
void |
accept(PicoVisitor visitor)
Accepts a visitor for this ComponentAdapter. |
Object |
decorateComponentInstance(PicoContainer container,
Type into,
Object instance)
A preexiting component instance can be injected into after instantiation |
ComponentAdapter |
findAdapterOfType(Class adapterType)
Locates a component adapter of type componentAdapterType in the ComponentAdapter chain. |
Class |
getComponentImplementation()
Retrieve the class of the component. |
Object |
getComponentInstance(PicoContainer container)
Deprecated. |
Object |
getComponentInstance(PicoContainer container,
Type into)
Retrieve the component instance. |
Object |
getComponentKey()
Retrieve the key associated with the component. |
ComponentAdapter |
getDelegate()
Component adapters may be nested in a chain, and this method is used to grab the next ComponentAdapter in the chain. |
String |
getDescriptor()
Get a string key descriptor of the component adapter. |
static Method |
getProvideMethod(Class clazz)
|
protected boolean |
useNames()
|
void |
verify(PicoContainer container)
Verify that all dependencies for this adapter can be satisfied. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
protected ProviderAdapter()
public ProviderAdapter(Object provider)
public ProviderAdapter(Object provider,
boolean useNames)
| Method Detail |
|---|
protected boolean useNames()
public Object decorateComponentInstance(PicoContainer container,
Type into,
Object instance)
Injector
decorateComponentInstance in interface Injectorcontainer - the container that can provide injectable dependenciesinstance - the instance to
public Object getComponentKey()
ComponentAdapter
getComponentKey in interface ComponentAdapterpublic Class getComponentImplementation()
ComponentAdapter
getComponentImplementation in interface ComponentAdapter
@Deprecated
public Object getComponentInstance(PicoContainer container)
throws PicoCompositionException
ComponentAdapterCached will always return the
same instance.
getComponentInstance in interface ComponentAdaptercontainer - 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 Object getComponentInstance(PicoContainer container,
Type into)
throws PicoCompositionException
ComponentAdapterCached will always return the
same instance.
getComponentInstance in interface ComponentAdaptercontainer - 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 static Method getProvideMethod(Class clazz)
public void verify(PicoContainer container)
throws PicoCompositionException
ComponentAdapter
verify in interface ComponentAdaptercontainer - the PicoContainer, that is used to resolve any possible dependencies of the instance.
PicoCompositionException - if one or more dependencies cannot be resolved.public void accept(PicoVisitor visitor)
ComponentAdapterPicoContainer, that
cascades the visitor also down to all its ComponentAdapter instances.
accept in interface ComponentAdaptervisitor - the visitor.public ComponentAdapter getDelegate()
ComponentAdapter
getDelegate in interface ComponentAdapterpublic ComponentAdapter findAdapterOfType(Class adapterType)
ComponentAdapter
findAdapterOfType in interface ComponentAdapterpublic String getDescriptor()
ComponentAdapter
getDescriptor in interface ComponentAdapter
|
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||