|
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.picocontainer.adapters.AbstractAdapter
org.picocontainer.injectors.AbstractInjector
public abstract class AbstractInjector
This ComponentAdapter will instantiate a new object for each call to
ComponentAdapter.getComponentInstance(PicoContainer).
That means that when used with a PicoContainer, getComponent will
return a new object each time.
| Nested Class Summary | |
|---|---|
static class |
AbstractInjector.AmbiguousComponentResolutionException
Exception that is thrown as part of the introspection. |
static class |
AbstractInjector.CyclicDependencyException
|
static class |
AbstractInjector.NotConcreteRegistrationException
|
static class |
AbstractInjector.UnsatisfiableDependenciesException
Exception thrown when some of the component's dependencies are not satisfiable. |
| Field Summary | |
|---|---|
protected LifecycleStrategy |
lifecycleStrategy
The strategy used to control the lifecycle |
protected Parameter[] |
parameters
The parameters to use for initialization. |
protected org.picocontainer.injectors.AbstractInjector.ThreadLocalCyclicDependencyGuard |
verifyingGuard
The cycle guard for the verification. |
| Constructor Summary | |
|---|---|
protected |
AbstractInjector(Object componentKey,
Class componentImplementation,
Parameter[] parameters,
ComponentMonitor monitor,
LifecycleStrategy lifecycleStrategy)
Constructs a new ComponentAdapter for the given key and implementation. |
| Method Summary | |
|---|---|
void |
accept(PicoVisitor visitor)
Accepts a visitor for this ComponentAdapter. |
protected Object |
caughtIllegalAccessException(ComponentMonitor componentMonitor,
Constructor constructor,
IllegalAccessException e,
PicoContainer container)
|
protected Object |
caughtIllegalAccessException(ComponentMonitor componentMonitor,
Member member,
Object componentInstance,
IllegalAccessException e)
|
protected Object |
caughtInstantiationException(ComponentMonitor componentMonitor,
Constructor constructor,
InstantiationException e,
PicoContainer container)
|
protected Object |
caughtInvocationTargetException(ComponentMonitor componentMonitor,
Member member,
Object componentInstance,
InvocationTargetException e)
|
protected Parameter[] |
createDefaultParameters(Class[] parameters)
Create default parameters for the given types. |
void |
dispose(Object component)
Invoke the "dispose" method on the component instance if this is disposable. |
boolean |
hasLifecycle(Class type)
Test if a component instance has a lifecycle. |
protected Object |
newInstance(Constructor constructor,
Object[] parameters)
Instantiate an object with given parameters and respect the accessible flag. |
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. |
abstract void |
verify(PicoContainer container)
Verify that all dependencies for this adapter can be satisifed. |
| Methods inherited from class org.picocontainer.adapters.AbstractAdapter |
|---|
changeMonitor, checkTypeCompatibility, currentMonitor, findAdapterOfType, getComponentImplementation, getComponentKey, getDelegate, toString |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface org.picocontainer.ComponentAdapter |
|---|
getComponentInstance |
| Field Detail |
|---|
protected transient org.picocontainer.injectors.AbstractInjector.ThreadLocalCyclicDependencyGuard verifyingGuard
protected transient Parameter[] parameters
protected LifecycleStrategy lifecycleStrategy
| Constructor Detail |
|---|
protected AbstractInjector(Object componentKey,
Class componentImplementation,
Parameter[] parameters,
ComponentMonitor monitor,
LifecycleStrategy lifecycleStrategy)
componentKey - the search key for this implementationcomponentImplementation - the concrete implementationparameters - the parameters to use for the initializationmonitor - the component monitor used by this ComponentAdapterlifecycleStrategy - the lifecycle strategy used by this ComponentAdapter
AbstractInjector.NotConcreteRegistrationException - if the implementation is not a concrete class
NullPointerException - if one of the parameters is null| Method Detail |
|---|
protected Parameter[] createDefaultParameters(Class[] parameters)
parameters - the parameter types
public abstract 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 ComponentAdapteraccept in class AbstractAdaptervisitor - the visitor.public void start(Object component)
LifecycleStrategy
start in interface LifecycleStrategycomponent - the instance of the component to startpublic void stop(Object component)
LifecycleStrategy
stop in interface LifecycleStrategycomponent - the instance of the component to stoppublic void dispose(Object component)
LifecycleStrategy
dispose in interface LifecycleStrategycomponent - the instance of the component to disposepublic boolean hasLifecycle(Class type)
LifecycleStrategy
hasLifecycle in interface LifecycleStrategytype - the component's type
true if the component has a lifecycle
protected Object newInstance(Constructor constructor,
Object[] parameters)
throws InstantiationException,
IllegalAccessException,
InvocationTargetException
constructor - the constructor to useparameters - the parameters for the constructor
InstantiationException
IllegalAccessException
InvocationTargetException
protected Object caughtInstantiationException(ComponentMonitor componentMonitor,
Constructor constructor,
InstantiationException e,
PicoContainer container)
protected Object caughtIllegalAccessException(ComponentMonitor componentMonitor,
Constructor constructor,
IllegalAccessException e,
PicoContainer container)
protected Object caughtInvocationTargetException(ComponentMonitor componentMonitor,
Member member,
Object componentInstance,
InvocationTargetException e)
protected Object caughtIllegalAccessException(ComponentMonitor componentMonitor,
Member member,
Object componentInstance,
IllegalAccessException e)
|
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||