Replace LiteralExpression to ValueExpression

This commit is contained in:
Artem Bilan
2014-04-17 14:22:07 +03:00
parent 305504196b
commit 2d9f01464b
4 changed files with 14 additions and 21 deletions

View File

@@ -53,4 +53,5 @@ public class AbstractRouterSpec<S extends AbstractRouterSpec<S, R>, R extends Ab
protected R doGet() {
throw new UnsupportedOperationException();
}
}

View File

@@ -17,7 +17,6 @@
package org.springframework.integration.dsl;
import org.springframework.expression.Expression;
import org.springframework.expression.common.LiteralExpression;
import org.springframework.expression.spel.standard.SpelExpressionParser;
import org.springframework.integration.aggregator.AbstractCorrelatingMessageHandler;
import org.springframework.integration.aggregator.CorrelationStrategy;
@@ -27,6 +26,7 @@ import org.springframework.integration.aggregator.ReleaseStrategy;
import org.springframework.integration.config.CorrelationStrategyFactoryBean;
import org.springframework.integration.config.ReleaseStrategyFactoryBean;
import org.springframework.integration.dsl.core.IntegrationComponentSpec;
import org.springframework.integration.expression.ValueExpression;
import org.springframework.integration.store.MessageGroupStore;
import org.springframework.messaging.MessageChannel;
import org.springframework.scheduling.TaskScheduler;
@@ -73,7 +73,7 @@ public abstract class CorrelationHandlerSpec<S extends CorrelationHandlerSpec<S,
}
public S groupTimeout(long groupTimeout) {
this.groupTimeoutExpression = new LiteralExpression("" + groupTimeout);
this.groupTimeoutExpression = new ValueExpression<Long>(groupTimeout);
return _this();
}

View File

@@ -98,12 +98,12 @@ public class EnricherSpec extends IntegrationComponentSpec<EnricherSpec, Content
return _this();
}
public EnricherSpec header(String name, Object value) {
public <V> EnricherSpec header(String name, V value) {
return this.header(name, value, null);
}
public EnricherSpec header(String name, Object value, Boolean overwrite) {
AbstractHeaderValueMessageProcessor<?> headerValueMessageProcessor = new StaticHeaderValueMessageProcessor<Object>(value);
public <V> EnricherSpec header(String name, V value, Boolean overwrite) {
AbstractHeaderValueMessageProcessor<V> headerValueMessageProcessor = new StaticHeaderValueMessageProcessor<V>(value);
headerValueMessageProcessor.setOverwrite(overwrite);
return this.header(name, headerValueMessageProcessor);
}
@@ -119,7 +119,7 @@ public class EnricherSpec extends IntegrationComponentSpec<EnricherSpec, Content
return this.header(name, headerValueMessageProcessor);
}
public EnricherSpec header(String name, HeaderValueMessageProcessor<?> headerValueMessageProcessor) {
public <V> EnricherSpec header(String name, HeaderValueMessageProcessor<V> headerValueMessageProcessor) {
Assert.notNull(name);
this.headerExpressions.put(name, headerValueMessageProcessor);
return _this();

View File

@@ -69,36 +69,28 @@ public class HeaderEnricherSpec extends IntegrationComponentSpec<HeaderEnricherS
return this.messageProcessor(new BeanNameMessageProcessor<Object>(beanName, methodName));
}
public HeaderEnricherSpec header(String name, Object value) {
public <V> HeaderEnricherSpec header(String name, V value) {
return this.header(name, value, null);
}
public HeaderEnricherSpec header(String name, Object value, Boolean overwrite) {
AbstractHeaderValueMessageProcessor<?> headerValueMessageProcessor = new StaticHeaderValueMessageProcessor<Object>(value);
public <V> HeaderEnricherSpec header(String name, V value, Boolean overwrite) {
AbstractHeaderValueMessageProcessor<V> headerValueMessageProcessor = new StaticHeaderValueMessageProcessor<V>(value);
headerValueMessageProcessor.setOverwrite(overwrite);
return this.header(name, headerValueMessageProcessor);
}
public HeaderEnricherSpec headerExpression(String name, String expression) {
return this.headerExpression(name, expression, null, null);
return this.headerExpression(name, expression, null);
}
public HeaderEnricherSpec headerExpression(String name, String expression, Boolean overwrite) {
return this.headerExpression(name, expression, overwrite, null);
}
public <T> HeaderEnricherSpec headerExpression(String name, String expression, Class<T> type) {
return this.headerExpression(name, expression, null, type);
}
public <T> HeaderEnricherSpec headerExpression(String name, String expression, Boolean overwrite, Class<T> type) {
AbstractHeaderValueMessageProcessor<T> headerValueMessageProcessor =
new ExpressionEvaluatingHeaderValueMessageProcessor<T>(expression, type);
AbstractHeaderValueMessageProcessor<?> headerValueMessageProcessor =
new ExpressionEvaluatingHeaderValueMessageProcessor<Object>(expression, null);
headerValueMessageProcessor.setOverwrite(overwrite);
return this.header(name, headerValueMessageProcessor);
}
public HeaderEnricherSpec header(String name, HeaderValueMessageProcessor<?> headerValueMessageProcessor) {
public <V> HeaderEnricherSpec header(String name, HeaderValueMessageProcessor<V> headerValueMessageProcessor) {
Assert.notNull(name);
this.headerToAdd.put(name, headerValueMessageProcessor);
return _this();