Class WorkbenchElementsPostProcessor

  • All Implemented Interfaces:
    BeanInformationRepository, WorkbenchElementsRepository, org.springframework.beans.factory.Aware, org.springframework.beans.factory.BeanFactoryAware, org.springframework.beans.factory.config.BeanPostProcessor

    public class WorkbenchElementsPostProcessor
    extends java.lang.Object
    implements org.springframework.beans.factory.BeanFactoryAware, org.springframework.beans.factory.config.BeanPostProcessor, WorkbenchElementsRepository, BeanInformationRepository
    A Spring bean post processor which has two main responsibilities:
    1. It collects factory methods of all beans created in the application context. This allows to get the name check for annotations on both, the factory methods and the bean classes themselves.
    2. It collects all beans which are recognized as minifx elements (by corresponding annotations). These are: views (see View), footers (see Footer) and toolbar items (see ToolbarItem).
    The collected information is exposed through the WorkbenchElementsRepository and BeanInformationRepository interfaces for further usage.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.util.Optional<java.lang.String> beanNameFor​(java.lang.Object bean)
      Retrieves the (cached) bean name (as used in the application context) for the given bean.
      java.util.Optional<java.lang.reflect.Method> factoryMethodFor​(java.lang.Object bean)
      Retrieves the (cached) factory method of the given bean if available.
      java.util.Set<java.lang.Object> footers()
      Returns all beans which were recognized as MiniFx footers within the application context.
      OngoingAnnotationExtraction from​(java.lang.Object object)
      Starting point of a fluent clause to find annotations of a given type from the bean.
      java.util.Set<java.lang.Object> perspectives()
      Returns all beans which were recognized as MiniFx perspectives within the application context.
      java.lang.Object postProcessAfterInitialization​(java.lang.Object bean, java.lang.String beanName)  
      java.lang.Object postProcessBeforeInitialization​(java.lang.Object bean, java.lang.String beanName)  
      void setBeanFactory​(org.springframework.beans.factory.BeanFactory beanFactory)  
      java.util.Set<java.lang.Object> toolbarItems()
      Returns all beans which were recognized as MiniFx toolbar items within the application context.
      java.util.Set<java.lang.Object> views()
      Returns all beans which were recognized as MiniFx views within the application context.
      • Methods inherited from class java.lang.Object

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

      • WorkbenchElementsPostProcessor

        public WorkbenchElementsPostProcessor()
    • Method Detail

      • postProcessBeforeInitialization

        public java.lang.Object postProcessBeforeInitialization​(java.lang.Object bean,
                                                                java.lang.String beanName)
        Specified by:
        postProcessBeforeInitialization in interface org.springframework.beans.factory.config.BeanPostProcessor
      • postProcessAfterInitialization

        public java.lang.Object postProcessAfterInitialization​(java.lang.Object bean,
                                                               java.lang.String beanName)
        Specified by:
        postProcessAfterInitialization in interface org.springframework.beans.factory.config.BeanPostProcessor
      • setBeanFactory

        public void setBeanFactory​(org.springframework.beans.factory.BeanFactory beanFactory)
        Specified by:
        setBeanFactory in interface org.springframework.beans.factory.BeanFactoryAware
      • factoryMethodFor

        public java.util.Optional<java.lang.reflect.Method> factoryMethodFor​(java.lang.Object bean)
        Description copied from interface: BeanInformationRepository
        Retrieves the (cached) factory method of the given bean if available.
        Specified by:
        factoryMethodFor in interface BeanInformationRepository
        Parameters:
        bean - the bean for which to retrieve the factory method.
        Returns:
        the factory method of the bean (if it has one)
      • beanNameFor

        public java.util.Optional<java.lang.String> beanNameFor​(java.lang.Object bean)
        Description copied from interface: BeanInformationRepository
        Retrieves the (cached) bean name (as used in the application context) for the given bean.
        Specified by:
        beanNameFor in interface BeanInformationRepository
        Parameters:
        bean - the bean for which to get the name
        Returns:
        the name of the bean if known
      • views

        public java.util.Set<java.lang.Object> views()
        Description copied from interface: WorkbenchElementsRepository
        Returns all beans which were recognized as MiniFx views within the application context. The returned beans are exactly those as found in the application context. No processing is done at this stage.
        Specified by:
        views in interface WorkbenchElementsRepository
        Returns:
        a set of all views
        See Also:
        View
      • toolbarItems

        public java.util.Set<java.lang.Object> toolbarItems()
        Description copied from interface: WorkbenchElementsRepository
        Returns all beans which were recognized as MiniFx toolbar items within the application context. The returned beans are exactly those as found in the application context. No processing is done at this stage.
        Specified by:
        toolbarItems in interface WorkbenchElementsRepository
        Returns:
        a set of all toolbar items
        See Also:
        ToolbarItem
      • footers

        public java.util.Set<java.lang.Object> footers()
        Description copied from interface: WorkbenchElementsRepository
        Returns all beans which were recognized as MiniFx footers within the application context. The returned beans are exactly those as found in the application context. No processing is done at this stage.
        Specified by:
        footers in interface WorkbenchElementsRepository
        Returns:
        a set of all footers
        See Also:
        Footer
      • perspectives

        public java.util.Set<java.lang.Object> perspectives()
        Description copied from interface: WorkbenchElementsRepository
        Returns all beans which were recognized as MiniFx perspectives within the application context. The returned beans are exactly those objects as found in the context. No processing is done at this stage yet.
        Specified by:
        perspectives in interface WorkbenchElementsRepository
        Returns:
        all the beans that are identified as perspectives.