Package org.picocontainer.lifecycle
Class CompositeLifecycleStrategy
java.lang.Object
org.picocontainer.lifecycle.CompositeLifecycleStrategy
- All Implemented Interfaces:
LifecycleStrategy
Allow for use of alternate LifecycleStrategy strategies to be used
at the same time. A component can be started/stopped/disposed according
to *any* of the supplied LifecycleStrategy instances.
- Author:
- Paul Hammant
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidInvoke the "dispose" method on the component instance if this is disposable.booleanhasLifecycle(Class<?> type) Test if a component instance has a lifecycle.booleanisLazy(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() ).voidInvoke the "start" method on the component instance if this is startable.voidInvoke the "stop" method on the component instance if this is stoppable.
-
Constructor Details
-
CompositeLifecycleStrategy
-
-
Method Details
-
start
Description copied from interface:LifecycleStrategyInvoke 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.- Specified by:
startin interfaceLifecycleStrategy- Parameters:
component- the instance of the component to start
-
stop
Description copied from interface:LifecycleStrategyInvoke 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.- Specified by:
stopin interfaceLifecycleStrategy- Parameters:
component- the instance of the component to stop
-
dispose
Description copied from interface:LifecycleStrategyInvoke 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.- Specified by:
disposein interfaceLifecycleStrategy- Parameters:
component- the instance of the component to dispose
-
hasLifecycle
Description copied from interface:LifecycleStrategyTest if a component instance has a lifecycle.- Specified by:
hasLifecyclein interfaceLifecycleStrategy- Parameters:
type- the component's type- Returns:
trueif the component has a lifecycle
-
isLazy
Description copied from interface:LifecycleStrategyIs 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() ). The default is the first of those two.- Specified by:
isLazyin interfaceLifecycleStrategy- Parameters:
adapter-- Returns:
- true if lazy, false if not lazy
-