Package org.picocontainer.lifecycle
Class StartableLifecycleStrategy
java.lang.Object
org.picocontainer.lifecycle.AbstractMonitoringLifecycleStrategy
org.picocontainer.lifecycle.StartableLifecycleStrategy
- All Implemented Interfaces:
Serializable,ComponentMonitorStrategy,LifecycleStrategy
Startable lifecycle strategy. Starts and stops component if Startable,
and disposes it if Disposable.
A subclass of this class can define other intrfaces for Startable/Disposable as well as other method names
for start/stop/dispose
- Author:
- Mauro Talevi, Jörg Schaible
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidInvoke the "dispose" method on the component instance if this is disposable.protected voiddisposeComponent(Object component) protected Classprotected StringRetrieve the lifecycle method name that represents the dispose method.protected Classprotected StringRetrieve the lifecycle method name that represents the start method.protected StringRetrieve the lifecycle method name that represents the stop method.booleanhasLifecycle(Class<?> type) Test if a component instance has a lifecycle.voidInvoke the "start" method on the component instance if this is startable.protected voidstartComponent(Object component) voidInvoke the "stop" method on the component instance if this is stoppable.protected voidstopComponent(Object component) Methods inherited from class org.picocontainer.lifecycle.AbstractMonitoringLifecycleStrategy
changeMonitor, currentMonitor, isLazy
-
Constructor Details
-
StartableLifecycleStrategy
-
-
Method Details
-
getDisposeMethodName
Retrieve the lifecycle method name that represents the dispose method.- Returns:
- the dispose method name. ('dispose')
-
getStopMethodName
Retrieve the lifecycle method name that represents the stop method.- Returns:
- the stop method name ('stop')
-
getStartMethodName
Retrieve the lifecycle method name that represents the start method.- Returns:
- the stop method name ('start')
-
start
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
-
startComponent
-
stopComponent
-
disposeComponent
-
stop
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
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
Test if a component instance has a lifecycle.- Parameters:
type- the component's type- Returns:
trueif the component has a lifecycle
-
getDisposableInterface
-
getStartableInterface
-