org.picocontainer.defaults
Class DefaultLifecycleStrategy
java.lang.Object
org.picocontainer.defaults.AbstractMonitoringLifecycleStrategy
org.picocontainer.defaults.DefaultLifecycleStrategy
- All Implemented Interfaces:
- java.io.Serializable, ComponentMonitorStrategy, LifecycleStrategy
public class DefaultLifecycleStrategy
- extends AbstractMonitoringLifecycleStrategy
Default lifecycle strategy. Starts and stops component if Startable,
and disposes it if Disposable.
- Author:
- Mauro Talevi, Jörg Schaible
- See Also:
Startable
,
Disposable
,
Serialized Form
Field Summary |
private static java.lang.reflect.Method |
dispose
|
private static java.lang.reflect.Method |
start
|
private static java.lang.reflect.Method |
stop
|
Method Summary |
void |
dispose(java.lang.Object component)
Invoke the "dispose" method on the component instance if this is disposable. |
boolean |
hasLifecycle(java.lang.Class type)
Test if a component instance has a lifecycle. |
void |
start(java.lang.Object component)
Invoke the "start" method on the component instance if this is startable. |
void |
stop(java.lang.Object component)
Invoke the "stop" method on the component instance if this is stoppable. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
start
private static java.lang.reflect.Method start
stop
private static java.lang.reflect.Method stop
dispose
private static java.lang.reflect.Method dispose
DefaultLifecycleStrategy
public DefaultLifecycleStrategy(ComponentMonitor monitor)
start
public void start(java.lang.Object component)
- Description copied from interface:
LifecycleStrategy
- Invoke the "start" method on the component instance if this is startable.
It is up to the implementation of the strategy what "start" and "startable" means.
- Parameters:
component
- the instance of the component to start
stop
public void stop(java.lang.Object component)
- Description copied from interface:
LifecycleStrategy
- Invoke the "stop" method on the component instance if this is stoppable.
It is up to the implementation of the strategy what "stop" and "stoppable" means.
- Parameters:
component
- the instance of the component to stop
dispose
public void dispose(java.lang.Object component)
- Description copied from interface:
LifecycleStrategy
- Invoke the "dispose" method on the component instance if this is disposable.
It is up to the implementation of the strategy what "dispose" and "disposable" means.
- Parameters:
component
- the instance of the component to dispose
hasLifecycle
public boolean hasLifecycle(java.lang.Class type)
- Description copied from interface:
LifecycleStrategy
- Test if a component instance has a lifecycle.
- Parameters:
type
- the component's type
- Returns:
true
if the component has a lifecycle