public class ProviderAdapter extends Object implements Injector, Provider, LifecycleStrategy
ComponentAdapter.NOTHING| Modifier | Constructor and Description |
|---|---|
protected |
ProviderAdapter() |
|
ProviderAdapter(LifecycleStrategy lifecycleStrategy,
Provider provider) |
|
ProviderAdapter(LifecycleStrategy lifecycleStrategy,
Provider provider,
boolean useNames) |
|
ProviderAdapter(Provider provider) |
|
ProviderAdapter(Provider provider,
boolean useNames) |
| Modifier and Type | Method and Description |
|---|---|
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
|
void |
dispose(Object component)
Invoke the "dispose" method on the component instance if this is disposable.
|
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 for use in toString()
|
static Method |
getProvideMethod(Class clazz) |
boolean |
hasLifecycle(Class<?> type)
Test if a component instance has a lifecycle.
|
boolean |
isLazy(ComponentAdapter<?> adapter)
Is a component eager (not lazy) in that it should start when start() or equivalent is called,
or lazy (it will only start on first getComponent() ).
|
void |
start(Object component)
Invoke the "start" method on the component instance if this is startable.
|
void |
stop(Object component)
Invoke the "stop" method on the component instance if this is stoppable.
|
protected boolean |
useNames() |
void |
verify(PicoContainer container)
Verify that all dependencies for this adapter can be satisfied.
|
protected ProviderAdapter()
public ProviderAdapter(LifecycleStrategy lifecycleStrategy, Provider provider)
public ProviderAdapter(Provider provider)
public ProviderAdapter(Provider provider, boolean useNames)
public ProviderAdapter(LifecycleStrategy lifecycleStrategy, Provider provider, boolean useNames)
protected boolean useNames()
public Object decorateComponentInstance(PicoContainer container, Type into, Object instance)
InjectordecorateComponentInstance in interface Injectorcontainer - the container that can provide injectable dependenciesinstance - the instance topublic Object getComponentKey()
ComponentAdaptergetComponentKey in interface ComponentAdapterpublic Class getComponentImplementation()
ComponentAdaptergetComponentImplementation 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
ComponentAdapterverify 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()
ComponentAdaptergetDelegate in interface ComponentAdapterpublic ComponentAdapter findAdapterOfType(Class adapterType)
ComponentAdapterfindAdapterOfType in interface ComponentAdapteradapterType - the class of the adapter type being located. Never null.public String getDescriptor()
ComponentAdaptergetDescriptor in interface ComponentAdapterpublic void start(Object component)
LifecycleStrategystart in interface LifecycleStrategycomponent - the instance of the component to startpublic void stop(Object component)
LifecycleStrategystop in interface LifecycleStrategycomponent - the instance of the component to stoppublic void dispose(Object component)
LifecycleStrategydispose in interface LifecycleStrategycomponent - the instance of the component to disposepublic boolean hasLifecycle(Class<?> type)
LifecycleStrategyhasLifecycle in interface LifecycleStrategytype - the component's typetrue if the component has a lifecyclepublic boolean isLazy(ComponentAdapter<?> adapter)
LifecycleStrategyisLazy in interface LifecycleStrategyCopyright © 2003-2014 Codehaus. All Rights Reserved.