Class BeanTimeStatistics

  • All Implemented Interfaces:
    BeanListener, java.util.EventListener, org.springframework.beans.factory.Aware, org.springframework.beans.factory.BeanNameAware

    public class BeanTimeStatistics
    extends java.lang.Object
    implements BeanListener, org.springframework.beans.factory.BeanNameAware
    Bean Time Statistics
    Since:
    1.0.0
    Author:
    Mercy
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      io.microsphere.util.StopWatch getStopWatch()  
      void onAfterBeanDestroy​(java.lang.String beanName, java.lang.Object bean)
      Handle the event after the bean destroy
      void onAfterBeanInitialized​(java.lang.String beanName, java.lang.Object bean)
      Handle the event after the bean initialization
      void onAfterBeanInstantiated​(java.lang.String beanName, org.springframework.beans.factory.support.RootBeanDefinition mergedBeanDefinition, java.lang.Object bean)
      Handle the event before after the bean instantiation
      void onBeanDefinitionReady​(java.lang.String beanName, org.springframework.beans.factory.support.RootBeanDefinition mergedBeanDefinition)
      Handle the event when the BeanDefinition is ready(merged)
      void onBeanPropertyValuesReady​(java.lang.String beanName, java.lang.Object bean, org.springframework.beans.PropertyValues pvs)
      Handle the event when the Beans' PropertyValues is ready
      void onBeanReady​(java.lang.String beanName, java.lang.Object bean)
      Handle the event on the bean ready
      void onBeforeBeanDestroy​(java.lang.String beanName, java.lang.Object bean)
      Handle the event before the bean destroy
      void onBeforeBeanInitialize​(java.lang.String beanName, java.lang.Object bean)
      Handle the event before the bean initialization
      void onBeforeBeanInstantiate​(java.lang.String beanName, org.springframework.beans.factory.support.RootBeanDefinition mergedBeanDefinition)
      Handle the event before the bean instantiation
      void onBeforeBeanInstantiate​(java.lang.String beanName, org.springframework.beans.factory.support.RootBeanDefinition mergedBeanDefinition, java.lang.Object factoryBean, java.lang.reflect.Method factoryMethod, java.lang.Object[] args)
      Handle the event before the bean instantiation using the factory method
      void onBeforeBeanInstantiate​(java.lang.String beanName, org.springframework.beans.factory.support.RootBeanDefinition mergedBeanDefinition, java.lang.reflect.Constructor<?> constructor, java.lang.Object[] args)
      Handle the event before the bean instantiation using the constructor
      void setBeanName​(java.lang.String name)  
      boolean supports​(java.lang.String beanName)
      Supports the bean to be listened or not
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • BeanTimeStatistics

        public BeanTimeStatistics()
    • Method Detail

      • supports

        public boolean supports​(java.lang.String beanName)
        Description copied from interface: BeanListener
        Supports the bean to be listened or not
        Specified by:
        supports in interface BeanListener
        Parameters:
        beanName - the name of bean
        Returns:
        If false, any method of bean lifecycle will not be called
      • onBeanDefinitionReady

        public void onBeanDefinitionReady​(java.lang.String beanName,
                                          org.springframework.beans.factory.support.RootBeanDefinition mergedBeanDefinition)
        Description copied from interface: BeanListener
        Handle the event when the BeanDefinition is ready(merged)
        Specified by:
        onBeanDefinitionReady in interface BeanListener
        Parameters:
        beanName - the bean name
        mergedBeanDefinition - the merged BeanDefinition
      • onBeforeBeanInstantiate

        public void onBeforeBeanInstantiate​(java.lang.String beanName,
                                            org.springframework.beans.factory.support.RootBeanDefinition mergedBeanDefinition)
        Description copied from interface: BeanListener
        Handle the event before the bean instantiation
        Specified by:
        onBeforeBeanInstantiate in interface BeanListener
        Parameters:
        beanName - the bean name
        mergedBeanDefinition - the merged BeanDefinition
      • onBeforeBeanInstantiate

        public void onBeforeBeanInstantiate​(java.lang.String beanName,
                                            org.springframework.beans.factory.support.RootBeanDefinition mergedBeanDefinition,
                                            java.lang.reflect.Constructor<?> constructor,
                                            java.lang.Object[] args)
        Description copied from interface: BeanListener
        Handle the event before the bean instantiation using the constructor
        Specified by:
        onBeforeBeanInstantiate in interface BeanListener
        Parameters:
        beanName - the bean name
        mergedBeanDefinition - the merged BeanDefinition
        constructor - the constructor for bean instantiation
        args - the arguments of constructor
      • onBeforeBeanInstantiate

        public void onBeforeBeanInstantiate​(java.lang.String beanName,
                                            org.springframework.beans.factory.support.RootBeanDefinition mergedBeanDefinition,
                                            java.lang.Object factoryBean,
                                            java.lang.reflect.Method factoryMethod,
                                            java.lang.Object[] args)
        Description copied from interface: BeanListener
        Handle the event before the bean instantiation using the factory method
        Specified by:
        onBeforeBeanInstantiate in interface BeanListener
        Parameters:
        beanName - the bean name
        mergedBeanDefinition - the merged BeanDefinition
        factoryBean - the factory bean(optional)
        factoryMethod - the factory Method for bean instantiation
      • onAfterBeanInstantiated

        public void onAfterBeanInstantiated​(java.lang.String beanName,
                                            org.springframework.beans.factory.support.RootBeanDefinition mergedBeanDefinition,
                                            java.lang.Object bean)
        Description copied from interface: BeanListener
        Handle the event before after the bean instantiation
        Specified by:
        onAfterBeanInstantiated in interface BeanListener
        Parameters:
        beanName - the bean name
        mergedBeanDefinition - the merged BeanDefinition
        bean - the bean has been instantiated, not initialized yet
      • onBeanPropertyValuesReady

        public void onBeanPropertyValuesReady​(java.lang.String beanName,
                                              java.lang.Object bean,
                                              org.springframework.beans.PropertyValues pvs)
        Description copied from interface: BeanListener
        Handle the event when the Beans' PropertyValues is ready
        Specified by:
        onBeanPropertyValuesReady in interface BeanListener
        Parameters:
        beanName - the bean name
        bean - the bean has been instantiated, not initialized yet
        pvs - the PropertyValues will be applied on bean
      • onBeforeBeanInitialize

        public void onBeforeBeanInitialize​(java.lang.String beanName,
                                           java.lang.Object bean)
        Description copied from interface: BeanListener
        Handle the event before the bean initialization
        Specified by:
        onBeforeBeanInitialize in interface BeanListener
        Parameters:
        beanName - the bean name
        bean - the bean is not initialized yet
      • onAfterBeanInitialized

        public void onAfterBeanInitialized​(java.lang.String beanName,
                                           java.lang.Object bean)
        Description copied from interface: BeanListener
        Handle the event after the bean initialization
        Specified by:
        onAfterBeanInitialized in interface BeanListener
        Parameters:
        beanName - the bean name
        bean - the bean has been initialized
      • onBeanReady

        public void onBeanReady​(java.lang.String beanName,
                                java.lang.Object bean)
        Description copied from interface: BeanListener
        Handle the event on the bean ready
        Specified by:
        onBeanReady in interface BeanListener
        Parameters:
        beanName - the bean name
        bean - the bean is prepared
      • onBeforeBeanDestroy

        public void onBeforeBeanDestroy​(java.lang.String beanName,
                                        java.lang.Object bean)
        Description copied from interface: BeanListener
        Handle the event before the bean destroy
        Specified by:
        onBeforeBeanDestroy in interface BeanListener
        Parameters:
        beanName - the bean name
        bean - the bean is to be destroyed
      • onAfterBeanDestroy

        public void onAfterBeanDestroy​(java.lang.String beanName,
                                       java.lang.Object bean)
        Description copied from interface: BeanListener
        Handle the event after the bean destroy
        Specified by:
        onAfterBeanDestroy in interface BeanListener
        Parameters:
        beanName - the bean name
        bean - the bean is destroyed
      • getStopWatch

        public io.microsphere.util.StopWatch getStopWatch()
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • setBeanName

        public void setBeanName​(java.lang.String name)
        Specified by:
        setBeanName in interface org.springframework.beans.factory.BeanNameAware