use of org.springframework.integration.annotation.Transformer in project spring-integration-samples by spring-projects.
the class DBoot method transform.
@Transformer(inputChannel = "foo")
@Bean
public MessageHandler transform() {
MessageTransformingHandler transformingHandler = new MessageTransformingHandler(new MethodInvokingTransformer(helpers(), "duplicate"));
transformingHandler.setOutputChannel(bar());
return transformingHandler;
}
use of org.springframework.integration.annotation.Transformer in project spring-integration by spring-projects.
the class TransformerAnnotationPostProcessor method createHandler.
@Override
protected MessageHandler createHandler(Object bean, Method method, List<Annotation> annotations) {
org.springframework.integration.transformer.Transformer transformer;
if (AnnotatedElementUtils.isAnnotated(method, Bean.class.getName())) {
Object target = this.resolveTargetBeanFromMethodWithBeanAnnotation(method);
transformer = this.extractTypeIfPossible(target, org.springframework.integration.transformer.Transformer.class);
if (transformer == null) {
if (this.extractTypeIfPossible(target, AbstractReplyProducingMessageHandler.class) != null) {
checkMessageHandlerAttributes(resolveTargetBeanName(method), annotations);
return (MessageHandler) target;
}
transformer = new MethodInvokingTransformer(target);
}
} else {
transformer = new MethodInvokingTransformer(bean, method);
}
MessageTransformingHandler handler = new MessageTransformingHandler(transformer);
this.setOutputChannelIfPresent(annotations, handler);
return handler;
}
use of org.springframework.integration.annotation.Transformer in project tutorials by eugenp.
the class TimeProcessorApplication method transform.
@Transformer(inputChannel = Processor.INPUT, outputChannel = Processor.OUTPUT)
public Object transform(Long timestamp) {
DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd hh:mm:ss");
String date = dateFormat.format(timestamp);
return date;
}
Aggregations