@@ -276,7 +276,7 @@ String name = (String) exp.getValue(tesla);
276
276
<programlisting language =" java" >Expression exp = parser.parseExpression("name == 'Nikola Tesla'");
277
277
boolean result = exp.getValue(context, Boolean.class); // evaluates to true</programlisting >
278
278
279
- <section >
279
+ <section id = " expressions-evaluation-context " >
280
280
<title >The EvaluationContext interface</title >
281
281
282
282
<para >The interface <interfacename >EvaluationContext</interfacename > is
@@ -305,7 +305,7 @@ boolean result = exp.getValue(context, Boolean.class); // evaluates to true</pr
305
305
expressions. Please refer to the JavaDoc of these classes for more
306
306
details.</para >
307
307
308
- <section >
308
+ <section id = " expressions-type-conversion " >
309
309
<title >Type Conversion</title >
310
310
311
311
<para >By default SpEL uses the conversion service available in Spring
@@ -513,7 +513,7 @@ Object nullValue = parser.parseExpression("null").getValue();
513
513
Double.parseDouble().</para >
514
514
</section >
515
515
516
- <section >
516
+ <section id = " expressions-properties-arrays " >
517
517
<title >Properties, Arrays, Lists, Maps, Indexers</title >
518
518
519
519
<para >Navigating with property references is easy, just use a period to
@@ -575,7 +575,7 @@ parser.parseExpression("Officers['advisors'][0].PlaceOfBirth.Country").setValue(
575
575
576
576
</programlisting >
577
577
</section >
578
- <section >
578
+ <section id = " expressions-inline-lists " >
579
579
<title >Inline lists</title >
580
580
581
581
<para >Lists can be expressed directly in an expression using {} notation.
@@ -592,7 +592,7 @@ List listOfLists = (List) parser.parseExpression("{{'a','b'},{'x','y'}}").getVal
592
592
to represent the expression, rather than building a new list on each evaluation.</para >
593
593
</section >
594
594
595
- <section >
595
+ <section id = " expressions-array-construction " >
596
596
<title >Array construction</title >
597
597
598
598
<para >Arrays can be built using the familiar Java syntax, optionally
@@ -611,7 +611,7 @@ int[][] numbers3 = (int[][]) parser.parseExpression("new int[4][5]").getValue(co
611
611
a multi-dimensional array.</para >
612
612
</section >
613
613
614
- <section >
614
+ <section id = " expressions-methods " >
615
615
<title >Methods</title >
616
616
617
617
<para >Methods are invoked using typical Java programming syntax. You may
@@ -625,10 +625,10 @@ boolean isMember = parser.parseExpression("isMember('Mihajlo Pupin')").getValue(
625
625
Boolean.class);</programlisting >
626
626
</section >
627
627
628
- <section >
628
+ <section id = " expressions-operators " >
629
629
<title >Operators</title >
630
630
631
- <section >
631
+ <section id = " expressions-operators-relational " >
632
632
<title >Relational operators</title >
633
633
634
634
<para >The relational operators; equal, not equal, less than, less than
@@ -666,7 +666,7 @@ boolean falseValue =
666
666
These are case insensitive.</para >
667
667
</section >
668
668
669
- <section >
669
+ <section id = " expressions-operators-logical " >
670
670
<title >Logical operators</title >
671
671
672
672
<para >The logical operators that are supported are and, or, and not.
@@ -701,7 +701,7 @@ String expression = "isMember('Nikola Tesla') and !isMember('Mihajlo Pupin')";
701
701
boolean falseValue = parser.parseExpression(expression).getValue(societyContext, Boolean.class);</programlisting ></para >
702
702
</section >
703
703
704
- <section >
704
+ <section id = " expressions-operators-mathematical " >
705
705
<title >Mathematical operators</title >
706
706
707
707
<para >The addition operator can be used on numbers, strings and dates.
@@ -742,7 +742,7 @@ int minusTwentyOne = parser.parseExpression("1+2-3*8").getValue(Integer.class);
742
742
</section >
743
743
</section >
744
744
745
- <section >
745
+ <section id = " expressions-assignment " >
746
746
<title >Assignment</title >
747
747
748
748
<para >Setting of a property is done by using the assignment operator.
@@ -764,7 +764,7 @@ String aleks = parser.parseExpression("Name = 'Alexandar Seovic'").getValue(inve
764
764
<para ></para >
765
765
</section >
766
766
767
- <section >
767
+ <section id = " expressions-types " >
768
768
<title >Types</title >
769
769
770
770
<para >The special 'T' operator can be used to specify an instance of
@@ -786,7 +786,7 @@ boolean trueValue =
786
786
</programlisting >
787
787
</section >
788
788
789
- <section >
789
+ <section id = " expressions-constrcutors " >
790
790
<title >Constructors</title >
791
791
792
792
<para >Constructors can be invoked using the new operator. The fully
@@ -820,7 +820,7 @@ parser.parseExpression("Name = #newName").getValue(context);
820
820
821
821
System.out.println(tesla.getName()) // "Mike Tesla"</programlisting >
822
822
823
- <section >
823
+ <section id = " expressions-this-root " >
824
824
<title >The #this and #root variables</title >
825
825
826
826
<para >The variable #this is always defined and refers to the current
@@ -847,7 +847,7 @@ List<Integer> primesGreaterThanTen =
847
847
</section >
848
848
849
849
<!--
850
- <section>
850
+ <section id="expressions-root" >
851
851
<title>The #root variable</title>
852
852
853
853
<para>The variable #root is always defined and refers to the
@@ -905,7 +905,7 @@ String helloWorldReversed =
905
905
parser.parseExpression("#reverseString('hello')").getValue(context, String.class);</programlisting >
906
906
</section >
907
907
908
- <section >
908
+ <section id = " expressions-bean-references " >
909
909
<title >Bean references</title >
910
910
<para >If the evaluation context has been configured with a bean resolver it is possible to
911
911
lookup beans from an expression using the (@) symbol.
@@ -918,7 +918,7 @@ context.setBeanResolver(new MyBeanResolver());
918
918
Object bean = parser.parseExpression("@foo").getValue(context);</programlisting >
919
919
</section >
920
920
921
- <section >
921
+ <section id = " expressions-operator-ternary " >
922
922
<title >Ternary Operator (If-Then-Else)</title >
923
923
924
924
<para >You can use the ternary operator for performing if-then-else
@@ -944,7 +944,7 @@ String queryResultString =
944
944
shorter syntax for the ternary operator.</para >
945
945
</section >
946
946
947
- <section >
947
+ <section id = " expressions-operator-elvis " >
948
948
<title >The Elvis Operator</title >
949
949
950
950
<para >The Elvis operator is a shortening of the ternary operator syntax
@@ -985,7 +985,7 @@ name = parser.parseExpression("Name?:'Elvis Presley'").getValue(context, String.
985
985
System.out.println(name); // Elvis Presley</programlisting >
986
986
</section >
987
987
988
- <section >
988
+ <section id = " expressions-operator-safe-navigation " >
989
989
<title >Safe Navigation operator</title >
990
990
991
991
<para >The Safe Navigation operator is used to avoid a
@@ -1022,7 +1022,7 @@ System.out.println(city); // null - does not throw NullPointerException!!!</prog
1022
1022
</note >
1023
1023
</section >
1024
1024
1025
- <section >
1025
+ <section id = " expressions-collection-selection " >
1026
1026
<title >Collection Selection</title >
1027
1027
1028
1028
<para >Selection is a powerful expression language feature that allows you
@@ -1057,7 +1057,7 @@ System.out.println(city); // null - does not throw NullPointerException!!!</prog
1057
1057
<literal >$[...]</literal >.</para >
1058
1058
</section >
1059
1059
1060
- <section >
1060
+ <section id = " expressions-collection-projection " >
1061
1061
<title >Collection Projection</title >
1062
1062
1063
1063
<para >Projection allows a collection to drive the evaluation of a
@@ -1078,7 +1078,7 @@ List placesOfBirth = (List)parser.parseExpression("Members.![placeOfBirth.city]"
1078
1078
projection expression against each map entry.</para >
1079
1079
</section >
1080
1080
1081
- <section >
1081
+ <section id = " expressions-templating " >
1082
1082
<title >Expression templating</title >
1083
1083
1084
1084
<para >Expression templates allow a mixing of literal text with one or
0 commit comments