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