Apply Some Java 8 Code Changes

* Make most functional interfaces as `@FunctionalInterface`
* Convert some abstract classes to `@FunctionalInterface` with `default` methods
* Apply Lambda style implementation in some places
* Remove `Function` in favor of similar in Java 8

*  Remove redundant code from `DefaultAmqpHeaderMapper` since we are already on Spring AMQP-2.0
* Add several ctors to the `ExpressionEvaluatingMessageListProcessor`
* Populate explicit `Boolean.class` `expectedType` from the `ExpressionEvaluatingReleaseStrategy`
This commit is contained in:
Artem Bilan
2016-08-26 14:52:23 -04:00
committed by Gary Russell
parent 89e0d134f5
commit 370be4853d
58 changed files with 208 additions and 270 deletions

View File

@@ -22,15 +22,19 @@ import org.springframework.scripting.ScriptSource;
/**
* @author David Turanski
* @author Artem Bilan
* @since 2.1
*/
@FunctionalInterface
public interface ScriptExecutor {
/**
* @param scriptSource The script source.
* @return The result of the execution.
*/
Object executeScript(ScriptSource scriptSource);
default Object executeScript(ScriptSource scriptSource) {
return executeScript(scriptSource, null);
}
/**
* @param scriptSource The script source.

View File

@@ -27,6 +27,7 @@ import org.springframework.messaging.Message;
* @author Oleg Zhurakousky
* @since 2.0.2
*/
@FunctionalInterface
public interface ScriptVariableGenerator {
Map<String, Object> generateScriptVariables(Message<?> message);

View File

@@ -60,11 +60,6 @@ public abstract class AbstractScriptExecutor implements ScriptExecutor {
}
}
@Override
public Object executeScript(ScriptSource scriptSource) {
return this.executeScript(scriptSource, null);
}
@Override
public Object executeScript(ScriptSource scriptSource, Map<String, Object> variables) {
Object result;