33
33
34
34
/**
35
35
* Represents projection, where a given operation is performed on all elements in some
36
- * input sequence, returning a new sequence of the same size. For example:
37
- * "{1,2,3,4,5,6,7,8,9,10}.!{#isEven(#this)}" returns "[n, y, n, y, n, y, n, y, n, y]"
36
+ * input sequence, returning a new sequence of the same size.
37
+ *
38
+ * <p>For example: <code>{1,2,3,4,5,6,7,8,9,10}.![#isEven(#this)]</code> evaluates
39
+ * to {@code [n, y, n, y, n, y, n, y, n, y]}.
38
40
*
39
41
* @author Andy Clement
40
42
* @author Mark Fisher
41
43
* @author Juergen Hoeller
44
+ * @author Sam Brannen
42
45
* @since 3.0
43
46
*/
44
47
public class Projection extends SpelNodeImpl {
@@ -64,9 +67,9 @@ protected ValueRef getValueRef(ExpressionState state) throws EvaluationException
64
67
65
68
// When the input is a map, we push a special context object on the stack
66
69
// before calling the specified operation. This special context object
67
- // has two fields 'key' and 'value' that refer to the map entries key
68
- // and value, and they can be referenced in the operation
69
- // eg. {'a':'y','b':'n'}.![value== 'y'? key: null]" == ['a', null]
70
+ // has two fields 'key' and 'value' that refer to the map entry's key
71
+ // and value, and they can be referenced in the operation -- for example,
72
+ // {'a':'y', 'b':'n'}.![value == 'y' ? key : null] evaluates to ['a', null].
70
73
if (operand instanceof Map <?, ?> mapData ) {
71
74
List <Object > result = new ArrayList <>();
72
75
for (Map .Entry <?, ?> entry : mapData .entrySet ()) {
0 commit comments