Package org.minifx.workbench.spring
Class WorkbenchElementsPostProcessor
- java.lang.Object
-
- org.minifx.workbench.spring.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:- 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.
- It collects all beans which are recognized as minifx elements (by corresponding annotations). These are: views
(see
View
), footers (seeFooter
) and toolbar items (seeToolbarItem
).
WorkbenchElementsRepository
andBeanInformationRepository
interfaces for further usage.
-
-
Constructor Summary
Constructors Constructor Description WorkbenchElementsPostProcessor()
-
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.
-
-
-
Method Detail
-
postProcessBeforeInitialization
public java.lang.Object postProcessBeforeInitialization(java.lang.Object bean, java.lang.String beanName)
- Specified by:
postProcessBeforeInitialization
in interfaceorg.springframework.beans.factory.config.BeanPostProcessor
-
postProcessAfterInitialization
public java.lang.Object postProcessAfterInitialization(java.lang.Object bean, java.lang.String beanName)
- Specified by:
postProcessAfterInitialization
in interfaceorg.springframework.beans.factory.config.BeanPostProcessor
-
setBeanFactory
public void setBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory)
- Specified by:
setBeanFactory
in interfaceorg.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 interfaceBeanInformationRepository
- 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 interfaceBeanInformationRepository
- Parameters:
bean
- the bean for which to get the name- Returns:
- the name of the bean if known
-
from
public OngoingAnnotationExtraction from(java.lang.Object object)
Description copied from interface:BeanInformationRepository
Starting point of a fluent clause to find annotations of a given type from the bean. The full syntax is like this:Optional<AnAnnotation> annotation = from(aBean).getAnnotation(AnAnnotation.class);
Details on the strategy to find the annotations, seeOngoingAnnotationExtraction
.- Specified by:
from
in interfaceBeanInformationRepository
- Parameters:
object
- the bean on which to find annotations- Returns:
- an object to specify the annotations to find
- See Also:
OngoingAnnotationExtraction
-
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 interfaceWorkbenchElementsRepository
- 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 interfaceWorkbenchElementsRepository
- 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 interfaceWorkbenchElementsRepository
- 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 interfaceWorkbenchElementsRepository
- Returns:
- all the beans that are identified as perspectives.
-
-