|
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.picocontainer.behaviors.AbstractBehavior<T>
public abstract class AbstractBehavior<T>
Component adapter which decorates another adapter.
This adapter supports a component monitor strategy
and will propagate change of monitor to the delegate if the delegate itself
support the monitor strategy.
This adapter also supports a lifecycle manager and a
lifecycle strategy if the delegate does.
| Field Summary | |
|---|---|
protected ComponentAdapter<T> |
delegate
|
| Constructor Summary | |
|---|---|
AbstractBehavior(ComponentAdapter<T> delegate)
|
|
| Method Summary | ||
|---|---|---|
void |
accept(PicoVisitor visitor)
Accepts a visitor for this ComponentAdapter. |
|
void |
changeMonitor(ComponentMonitor monitor)
Delegates change of monitor if the delegate supports a component monitor strategy. |
|
boolean |
componentHasLifecycle()
Invokes delegate hasLifecycle method if the delegate is a Behavior Test if a component honors a lifecycle. |
|
ComponentMonitor |
currentMonitor()
Returns delegate's current monitor if the delegate supports a component monitor strategy. |
|
void |
dispose(Object component)
Invokes delegate dispose method if the delegate is a LifecycleStrategy Invoke the "dispose" method on the component instance if this is disposable. |
|
void |
dispose(PicoContainer container)
Invokes delegate dispose method if the delegate is a Behavior Invoke the "dispose" method on the component. |
|
|
findAdapterOfType(Class<U> componentAdapterType)
|
|
Class<T> |
getComponentImplementation()
Retrieve the class of the component. |
|
T |
getComponentInstance(PicoContainer container)
Retrieve the component instance. |
|
Object |
getComponentKey()
Retrieve the key associated with the component. |
|
ComponentAdapter<T> |
getDelegate()
|
|
boolean |
hasLifecycle(Class type)
Invokes delegate hasLifecycle(Class) method if the delegate is a LifecycleStrategy Test if a component instance has a lifecycle. |
|
void |
start(Object component)
Invokes delegate start method if the delegate is a LifecycleStrategy Invoke the "start" method on the component instance if this is startable. |
|
void |
start(PicoContainer container)
Invokes delegate start method if the delegate is a Behavior Invoke the "start" method on the component. |
|
void |
stop(Object component)
Invokes delegate stop method if the delegate is a LifecycleStrategy Invoke the "stop" method on the component instance if this is stoppable. |
|
void |
stop(PicoContainer container)
Invokes delegate stop method if the delegate is a Behavior Invoke the "stop" method on the component. |
|
String |
toString()
|
|
void |
verify(PicoContainer container)
Verify that all dependencies for this adapter can be satisifed. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected final ComponentAdapter<T> delegate
| Constructor Detail |
|---|
public AbstractBehavior(ComponentAdapter<T> delegate)
| Method Detail |
|---|
public Object getComponentKey()
ComponentAdapter
getComponentKey in interface ComponentAdapter<T>public Class<T> getComponentImplementation()
ComponentAdapter
getComponentImplementation in interface ComponentAdapter<T>
public T getComponentInstance(PicoContainer container)
throws PicoCompositionException
ComponentAdapterCached will always return the
same instance.
getComponentInstance in interface ComponentAdapter<T>container - the PicoContainer, that is used to resolve any possible dependencies of the instance.
PicoCompositionException - if the component could not be instantiated.
public void verify(PicoContainer container)
throws PicoCompositionException
ComponentAdapter
verify in interface ComponentAdapter<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 ComponentAdapter<T> getDelegate()
getDelegate in interface ComponentAdapter<T>public final <U extends ComponentAdapter> U findAdapterOfType(Class<U> componentAdapterType)
findAdapterOfType in interface ComponentAdapter<T>public void accept(PicoVisitor visitor)
ComponentAdapterPicoContainer, that
cascades the visitor also down to all its ComponentAdapter instances.
accept in interface ComponentAdapter<T>visitor - the visitor.public void changeMonitor(ComponentMonitor monitor)
changeMonitor in interface ComponentMonitorStrategymonitor - the new ComponentMonitor to usepublic ComponentMonitor currentMonitor()
currentMonitor in interface ComponentMonitorStrategyPicoCompositionException - if no component monitor is found in delegatepublic void start(PicoContainer container)
start in interface Behavior<T>container - the container to "start" the componentpublic void stop(PicoContainer container)
stop in interface Behavior<T>container - the container to "stop" the componentpublic void dispose(PicoContainer container)
dispose in interface Behavior<T>container - the container to "dispose" the componentpublic boolean componentHasLifecycle()
componentHasLifecycle in interface Behavior<T>true if the component has a lifecyclepublic void start(Object component)
start in interface LifecycleStrategycomponent - the instance of the component to startpublic void stop(Object component)
stop in interface LifecycleStrategycomponent - the instance of the component to stoppublic void dispose(Object component)
dispose in interface LifecycleStrategycomponent - the instance of the component to disposepublic boolean hasLifecycle(Class type)
hasLifecycle in interface LifecycleStrategytype - the component's type
true if the component has a lifecyclepublic String toString()
toString in class Object
|
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||