Example usage for org.springframework.statemachine.processor StateMachineHandler getBeanClass

List of usage examples for org.springframework.statemachine.processor StateMachineHandler getBeanClass

Introduction

In this page you can find the example usage for org.springframework.statemachine.processor StateMachineHandler getBeanClass.

Prototype

public Class<?> getBeanClass() 

Source Link

Document

Gets the bean class.

Usage

From source file:org.springframework.statemachine.processor.StateMachineHandlerCallHelper.java

@SuppressWarnings("unchecked")
@Override// ww  w .j ava  2 s. c o m
public void afterPropertiesSet() throws Exception {
    if (!(beanFactory instanceof ListableBeanFactory)) {
        log.info("Beanfactory is not instance of ListableBeanFactory, was " + beanFactory
                + " thus Disabling handlers.");
        return;
    }
    if (beanFactory.containsBean(StateMachineHandlerApplicationListener.BEAN_NAME)) {
        this.stateMachineHandlerApplicationListener = beanFactory.getBean(
                StateMachineHandlerApplicationListener.BEAN_NAME, StateMachineHandlerApplicationListener.class);
    }
    for (StateMachineHandler<? extends Annotation, S, E> handler : beanFactory
            .getBeansOfType(StateMachineHandler.class).values()) {
        Annotation annotation = handler.getAnnotation();
        Annotation metaAnnotation = handler.getMetaAnnotation();
        WithStateMachine withStateMachine = AnnotationUtils.findAnnotation(handler.getBeanClass(),
                WithStateMachine.class);
        String statemachineBeanName = withStateMachine.name();
        String key = metaAnnotation.annotationType().getName() + statemachineBeanName;
        List<CacheEntry> list = cache.get(key);
        if (list == null) {
            list = new ArrayList<>();
            cache.put(key, list);
        }
        list.add(new CacheEntry(handler, annotation, metaAnnotation));
    }
}