Class 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)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • NO_METHODS

        private static final java.lang.reflect.Method[] NO_METHODS
      • 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 superclass
        stopMethods - 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; otherwise false
      • isStoppable

        public boolean isStoppable()
        Returns:
        true if this lifecycle can be stopped; otherwise false
      • 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 interface java.security.PrivilegedAction<java.lang.Void>
      • toArray

        private static java.lang.reflect.Method[] toArray​(java.util.List<java.lang.reflect.Method> methods)