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

@@ -41,7 +41,6 @@ import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.springframework.integration.splitter.AbstractMessageSplitter;
import org.springframework.integration.util.Function;
import org.springframework.integration.util.FunctionIterator;
import org.springframework.integration.xml.DefaultXmlPayloadConverter;
import org.springframework.integration.xml.XmlPayloadConverter;
@@ -210,20 +209,15 @@ public class XPathMessageSplitter extends AbstractMessageSplitter {
return splitStrings;
}
else {
return new FunctionIterator<Node, String>((Iterator<Node>) nodes, new Function<Node, String>() {
@Override
public String apply(Node node) {
StringResult result = new StringResult();
try {
transformer.transform(new DOMSource(node), result);
}
catch (TransformerException e) {
throw new IllegalStateException("failed to create DocumentBuilder", e);
}
return result.toString();
return new FunctionIterator<>((Iterator<Node>) nodes, node -> {
StringResult result = new StringResult();
try {
transformer.transform(new DOMSource(node), result);
}
catch (TransformerException e) {
throw new IllegalStateException("failed to create DocumentBuilder", e);
}
return result.toString();
});
}
}