Skip to content

Commit

Permalink
Replace LiteralExpression to ValueExpression
Browse files Browse the repository at this point in the history
  • Loading branch information
Artem Bilan committed Apr 17, 2014
1 parent 3055041 commit 2d9f014
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 21 deletions.
Expand Up @@ -53,4 +53,5 @@ public S applySequence(boolean applySequence) {
protected R doGet() {
throw new UnsupportedOperationException();
}

}
Expand Up @@ -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;
Expand All @@ -27,6 +26,7 @@
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;
Expand Down Expand Up @@ -73,7 +73,7 @@ public S minimumTimeoutForEmptyGroups(long minimumTimeoutForEmptyGroups) {
}

public S groupTimeout(long groupTimeout) {
this.groupTimeoutExpression = new LiteralExpression("" + groupTimeout);
this.groupTimeoutExpression = new ValueExpression<Long>(groupTimeout);
return _this();
}

Expand Down
Expand Up @@ -98,12 +98,12 @@ public EnricherSpec propertyExpression(String key, String expression) {
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);
}
Expand All @@ -119,7 +119,7 @@ public EnricherSpec headerExpression(String name, String expression, Boolean ove
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();
Expand Down
Expand Up @@ -69,36 +69,28 @@ public HeaderEnricherSpec messageProcessor(String beanName, String methodName) {
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();
Expand Down

0 comments on commit 2d9f014

Please sign in to comment.