Package org.eclipse.sisu.bean
Class BeanLifecycle
- java.lang.Object
-
- org.eclipse.sisu.bean.BeanLifecycle
-
- All Implemented Interfaces:
java.security.PrivilegedAction<java.lang.Void>
final class BeanLifecycle extends java.lang.Object implements java.security.PrivilegedAction<java.lang.Void>
Represents the JSR250 lifecycle for a particular bean type.
-
-
Field Summary
Fields Modifier and Type Field Description private static java.lang.reflect.Method[]
NO_METHODS
(package private) static BeanLifecycle
NO_OP
private java.lang.reflect.Method[]
startMethods
private java.lang.reflect.Method[]
stopMethods
-
Constructor Summary
Constructors Constructor Description BeanLifecycle(java.util.List<java.lang.reflect.Method> startMethods, java.util.List<java.lang.reflect.Method> stopMethods)
Creates a new lifecycle based on the given start and stop methods.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
isStartable()
boolean
isStoppable()
java.lang.Void
run()
void
start(java.lang.Object bean)
Starts the given bean by invoking the methods defined in this lifecycle.void
stop(java.lang.Object bean)
Stops the given bean by invoking the methods defined in this lifecycle.private static java.lang.reflect.Method[]
toArray(java.util.List<java.lang.reflect.Method> methods)
-
-
-
Field Detail
-
NO_METHODS
private static final java.lang.reflect.Method[] NO_METHODS
-
NO_OP
static final BeanLifecycle NO_OP
-
startMethods
private final java.lang.reflect.Method[] startMethods
-
stopMethods
private final java.lang.reflect.Method[] stopMethods
-
-
Constructor Detail
-
BeanLifecycle
BeanLifecycle(java.util.List<java.lang.reflect.Method> startMethods, java.util.List<java.lang.reflect.Method> stopMethods)
Creates a new lifecycle based on the given start and stop methods.- Parameters:
startMethods
- The methods used to start the bean; from subclass to superclassstopMethods
- The methods used to stop the bean; from subclass to superclass
-
-
Method Detail
-
isStartable
public boolean isStartable()
- Returns:
true
if this lifecycle can be started; otherwisefalse
-
isStoppable
public boolean isStoppable()
- Returns:
true
if this lifecycle can be stopped; otherwisefalse
-
start
public void start(java.lang.Object bean)
Starts the given bean by invoking the methods defined in this lifecycle.- Parameters:
bean
- The bean to start
-
stop
public void stop(java.lang.Object bean)
Stops the given bean by invoking the methods defined in this lifecycle.- Parameters:
bean
- The bean to stop
-
run
public java.lang.Void run()
- Specified by:
run
in interfacejava.security.PrivilegedAction<java.lang.Void>
-
toArray
private static java.lang.reflect.Method[] toArray(java.util.List<java.lang.reflect.Method> methods)
-
-