Class BeanLifecycle

java.lang.Object
org.eclipse.sisu.bean.BeanLifecycle
All Implemented Interfaces:
PrivilegedAction<Void>

final class BeanLifecycle extends Object implements PrivilegedAction<Void>
Represents the JSR250 lifecycle for a particular bean type.
  • Field Details

    • NO_METHODS

      private static final Method[] NO_METHODS
    • NO_OP

      static final BeanLifecycle NO_OP
    • startMethods

      private final Method[] startMethods
    • stopMethods

      private final Method[] stopMethods
  • Constructor Details

    • BeanLifecycle

      BeanLifecycle(List<Method> startMethods, List<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 superclass
      stopMethods - The methods used to stop the bean; from subclass to superclass
  • Method Details

    • isStartable

      public boolean isStartable()
      Returns:
      true if this lifecycle can be started; otherwise false
    • isStoppable

      public boolean isStoppable()
      Returns:
      true if this lifecycle can be stopped; otherwise false
    • start

      public void start(Object bean)
      Starts the given bean by invoking the methods defined in this lifecycle.
      Parameters:
      bean - The bean to start
    • stop

      public void stop(Object bean)
      Stops the given bean by invoking the methods defined in this lifecycle.
      Parameters:
      bean - The bean to stop
    • run

      public Void run()
      Specified by:
      run in interface PrivilegedAction<Void>
    • toArray

      private static Method[] toArray(List<Method> methods)