Example usage for org.springframework.statemachine.support AnnotatedMethodFilter AnnotatedMethodFilter

List of usage examples for org.springframework.statemachine.support AnnotatedMethodFilter AnnotatedMethodFilter

Introduction

In this page you can find the example usage for org.springframework.statemachine.support AnnotatedMethodFilter AnnotatedMethodFilter.

Prototype

public AnnotatedMethodFilter(Class<? extends Annotation> annotationType, String methodName,
            boolean requiresReply) 

Source Link

Usage

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

private void prepareEvaluationContext(StandardEvaluationContext context, Object method,
        Class<? extends Annotation> annotationType) {
    Class<?> targetType = AopUtils.getTargetClass(this.targetObject);
    if (method instanceof Method) {
        context.registerMethodFilter(targetType, new FixedMethodFilter((Method) method));
        if (expectedType != null) {
            Assert.state(// w  ww.ja v  a2 s .  c  o m
                    context.getTypeConverter().canConvert(
                            TypeDescriptor.valueOf(((Method) method).getReturnType()),
                            TypeDescriptor.valueOf(expectedType)),
                    "Cannot convert to expected type (" + expectedType + ") from " + method);
        }
    } else if (method == null || method instanceof String) {
        AnnotatedMethodFilter filter = new AnnotatedMethodFilter(annotationType, (String) method,
                this.requiresReply);
        Assert.state(canReturnExpectedType(filter, targetType, context.getTypeConverter()),
                "Cannot convert to expected type (" + expectedType + ") from " + method);
        context.registerMethodFilter(targetType, filter);
    }
    context.setVariable("target", targetObject);
}