use of org.springframework.integration.util.AnnotatedMethodFilter in project spring-integration by spring-projects.
the class MessagingMethodInvokerHelper method prepareEvaluationContext.
private void prepareEvaluationContext() throws Exception {
StandardEvaluationContext context = getEvaluationContext(false);
Class<?> targetType = AopUtils.getTargetClass(this.targetObject);
if (this.method != null) {
context.registerMethodFilter(targetType, new FixedMethodFilter(this.method));
if (this.expectedType != null) {
Assert.state(context.getTypeConverter().canConvert(TypeDescriptor.valueOf((this.method).getReturnType()), this.expectedType), "Cannot convert to expected type (" + this.expectedType + ") from " + this.method);
}
} else {
AnnotatedMethodFilter filter = new AnnotatedMethodFilter(this.annotationType, this.methodName, this.requiresReply);
Assert.state(canReturnExpectedType(filter, targetType, context.getTypeConverter()), "Cannot convert to expected type (" + this.expectedType + ") from " + this.method);
context.registerMethodFilter(targetType, filter);
}
context.setVariable("target", this.targetObject);
context.registerFunction("requiredHeader", ParametersWrapper.class.getDeclaredMethod("getHeader", Map.class, String.class));
}
Aggregations