diff --git a/spring-expression/src/main/java/org/springframework/expression/spel/ast/Projection.java b/spring-expression/src/main/java/org/springframework/expression/spel/ast/Projection.java index b81e050284c..94d174737a1 100644 --- a/spring-expression/src/main/java/org/springframework/expression/spel/ast/Projection.java +++ b/spring-expression/src/main/java/org/springframework/expression/spel/ast/Projection.java @@ -33,12 +33,15 @@ import org.springframework.util.ObjectUtils; /** * Represents projection, where a given operation is performed on all elements in some - * input sequence, returning a new sequence of the same size. For example: - * "{1,2,3,4,5,6,7,8,9,10}.!{#isEven(#this)}" returns "[n, y, n, y, n, y, n, y, n, y]" + * input sequence, returning a new sequence of the same size. + * + *

For example: {1,2,3,4,5,6,7,8,9,10}.![#isEven(#this)] evaluates + * to {@code [n, y, n, y, n, y, n, y, n, y]}. * * @author Andy Clement * @author Mark Fisher * @author Juergen Hoeller + * @author Sam Brannen * @since 3.0 */ public class Projection extends SpelNodeImpl { @@ -64,9 +67,9 @@ public class Projection extends SpelNodeImpl { // When the input is a map, we push a special context object on the stack // before calling the specified operation. This special context object - // has two fields 'key' and 'value' that refer to the map entries key - // and value, and they can be referenced in the operation - // eg. {'a':'y','b':'n'}.![value=='y'?key:null]" == ['a', null] + // has two fields 'key' and 'value' that refer to the map entry's key + // and value, and they can be referenced in the operation -- for example, + // {'a':'y', 'b':'n'}.![value == 'y' ? key : null] evaluates to ['a', null]. if (operand instanceof Map mapData) { List result = new ArrayList<>(); for (Map.Entry entry : mapData.entrySet()) { diff --git a/spring-expression/src/main/java/org/springframework/expression/spel/ast/Selection.java b/spring-expression/src/main/java/org/springframework/expression/spel/ast/Selection.java index ce8910cc01a..e33b77e3b62 100644 --- a/spring-expression/src/main/java/org/springframework/expression/spel/ast/Selection.java +++ b/spring-expression/src/main/java/org/springframework/expression/spel/ast/Selection.java @@ -37,11 +37,11 @@ import org.springframework.util.ObjectUtils; /** * Represents selection over a map or collection. * - *

For example, {1,2,3,4,5,6,7,8,9,10}.?{#isEven(#this)} evaluates + *

For example, {1,2,3,4,5,6,7,8,9,10}.?[#isEven(#this)] evaluates * to {@code [2, 4, 6, 8, 10]}. * - *

Basically a subset of the input data is returned based on the - * evaluation of the expression supplied as selection criteria. + *

Basically a subset of the input data is returned based on the evaluation of + * the expression supplied as selection criteria. * * @author Andy Clement * @author Mark Fisher