@@ -517,7 +517,7 @@ kinds of expression cannot be compiled at the moment:
517
517
* Expressions using custom resolvers or accessors
518
518
* Expressions using selection or projection
519
519
520
- More types of expression will be compilable in the future.
520
+ More types of expressions will be compilable in the future.
521
521
522
522
523
523
@@ -589,7 +589,7 @@ You can also refer to other bean properties by name, as the following example sh
589
589
To specify a default value, you can place the `@Value` annotation on fields, methods,
590
590
and method or constructor parameters.
591
591
592
- The following example sets the default value of a field variable :
592
+ The following example sets the default value of a field:
593
593
594
594
[source,java,indent=0,subs="verbatim,quotes",role="primary"]
595
595
.Java
@@ -788,18 +788,18 @@ using a literal on one side of a logical comparison operator.
788
788
----
789
789
790
790
Numbers support the use of the negative sign, exponential notation, and decimal points.
791
- By default, real numbers are parsed by using Double.parseDouble().
791
+ By default, real numbers are parsed by using ` Double.parseDouble()` .
792
792
793
793
794
794
795
795
[[expressions-properties-arrays]]
796
796
=== Properties, Arrays, Lists, Maps, and Indexers
797
797
798
798
Navigating with property references is easy. To do so, use a period to indicate a nested
799
- property value. The instances of the `Inventor` class, `pupin` and `tesla`, were populated with
800
- data listed in the <<expressions-example-classes, Classes used in the examples>> section.
801
- To navigate "` down`" and get Tesla's year of birth and Pupin's city of birth, we use the following
802
- expressions:
799
+ property value. The instances of the `Inventor` class, `pupin` and `tesla`, were
800
+ populated with data listed in the <<expressions-example-classes, Classes used in the
801
+ examples>> section. To navigate "down" the object graph and get Tesla's year of birth and
802
+ Pupin's city of birth, we use the following expressions:
803
803
804
804
[source,java,indent=0,subs="verbatim,quotes",role="primary"]
805
805
.Java
@@ -939,7 +939,7 @@ You can directly express lists in an expression by using `{}` notation.
939
939
----
940
940
941
941
`{}` by itself means an empty list. For performance reasons, if the list is itself
942
- entirely composed of fixed literals, a constant list is created to represent the
942
+ entirely composed of fixed literals, a constant list is created to represent the
943
943
expression (rather than building a new list on each evaluation).
944
944
945
945
@@ -967,10 +967,11 @@ following example shows how to do so:
967
967
val mapOfMaps = parser.parseExpression("{name:{first:'Nikola',last:'Tesla'},dob:{day:10,month:'July',year:1856}}").getValue(context) as Map<*, *>
968
968
----
969
969
970
- `{:}` by itself means an empty map. For performance reasons, if the map is itself composed
971
- of fixed literals or other nested constant structures (lists or maps), a constant map is created
972
- to represent the expression (rather than building a new map on each evaluation). Quoting of the map keys
973
- is optional. The examples above do not use quoted keys.
970
+ `{:}` by itself means an empty map. For performance reasons, if the map is itself
971
+ composed of fixed literals or other nested constant structures (lists or maps), a
972
+ constant map is created to represent the expression (rather than building a new map on
973
+ each evaluation). Quoting of the map keys is optional (unless the key contains a period
974
+ (`.`)). The examples above do not use quoted keys.
974
975
975
976
976
977
@@ -1003,8 +1004,7 @@ to have the array populated at construction time. The following example shows ho
1003
1004
val numbers3 = parser.parseExpression("new int[4][5]").getValue(context) as Array<IntArray>
1004
1005
----
1005
1006
1006
- You cannot currently supply an initializer when you construct
1007
- multi-dimensional array.
1007
+ You cannot currently supply an initializer when you construct a multi-dimensional array.
1008
1008
1009
1009
1010
1010
@@ -1105,7 +1105,7 @@ expression-based `matches` operator. The following listing shows examples of bot
1105
1105
boolean trueValue = parser.parseExpression(
1106
1106
"'5.00' matches '^-?\\d+(\\.\\d{2})?$'").getValue(Boolean.class);
1107
1107
1108
- //evaluates to false
1108
+ // evaluates to false
1109
1109
boolean falseValue = parser.parseExpression(
1110
1110
"'5.0067' matches '^-?\\d+(\\.\\d{2})?$'").getValue(Boolean.class);
1111
1111
----
@@ -1120,14 +1120,14 @@ expression-based `matches` operator. The following listing shows examples of bot
1120
1120
val trueValue = parser.parseExpression(
1121
1121
"'5.00' matches '^-?\\d+(\\.\\d{2})?$'").getValue(Boolean::class.java)
1122
1122
1123
- //evaluates to false
1123
+ // evaluates to false
1124
1124
val falseValue = parser.parseExpression(
1125
1125
"'5.0067' matches '^-?\\d+(\\.\\d{2})?$'").getValue(Boolean::class.java)
1126
1126
----
1127
1127
1128
- CAUTION: Be careful with primitive types, as they are immediately boxed up to the wrapper type,
1129
- so `1 instanceof T(int)` evaluates to `false` while `1 instanceof T(Integer)`
1130
- evaluates to `true`, as expected.
1128
+ CAUTION: Be careful with primitive types, as they are immediately boxed up to their
1129
+ wrapper types. For example, `1 instanceof T(int)` evaluates to `false`, while
1130
+ `1 instanceof T(Integer)` evaluates to `true`, as expected.
1131
1131
1132
1132
Each symbolic operator can also be specified as a purely alphabetic equivalent. This
1133
1133
avoids problems where the symbols used have special meaning for the document type in
@@ -1155,7 +1155,7 @@ SpEL supports the following logical operators:
1155
1155
* `or` (`||`)
1156
1156
* `not` (`!`)
1157
1157
1158
- The following example shows how to use the logical operators
1158
+ The following example shows how to use the logical operators:
1159
1159
1160
1160
[source,java,indent=0,subs="verbatim,quotes",role="primary"]
1161
1161
.Java
@@ -1222,10 +1222,11 @@ The following example shows how to use the logical operators
1222
1222
[[expressions-operators-mathematical]]
1223
1223
==== Mathematical Operators
1224
1224
1225
- You can use the addition operator on both numbers and strings. You can use the subtraction, multiplication,
1226
- and division operators only on numbers. You can also use
1227
- the modulus (%) and exponential power (^) operators. Standard operator precedence is enforced. The
1228
- following example shows the mathematical operators in use:
1225
+ You can use the addition operator (`+`) on both numbers and strings. You can use the
1226
+ subtraction (`-`), multiplication (`*`), and division (`/`) operators only on numbers.
1227
+ You can also use the modulus (`%`) and exponential power (`^`) operators on numbers.
1228
+ Standard operator precedence is enforced. The following example shows the mathematical
1229
+ operators in use:
1229
1230
1230
1231
[source,java,indent=0,subs="verbatim,quotes",role="primary"]
1231
1232
.Java
@@ -1296,9 +1297,9 @@ following example shows the mathematical operators in use:
1296
1297
[[expressions-assignment]]
1297
1298
==== The Assignment Operator
1298
1299
1299
- To setting a property, use the assignment operator (`=`). This is typically
1300
- done within a call to `setValue` but can also be done inside a call to `getValue`. The
1301
- following listing shows both ways to use the assignment operator:
1300
+ To set a property, use the assignment operator (`=`). This is typically done within a
1301
+ call to `setValue` but can also be done inside a call to `getValue`. The following
1302
+ listing shows both ways to use the assignment operator:
1302
1303
1303
1304
[source,java,indent=0,subs="verbatim,quotes",role="primary"]
1304
1305
.Java
@@ -1333,9 +1334,9 @@ You can use the special `T` operator to specify an instance of `java.lang.Class`
1333
1334
type). Static methods are invoked by using this operator as well. The
1334
1335
`StandardEvaluationContext` uses a `TypeLocator` to find types, and the
1335
1336
`StandardTypeLocator` (which can be replaced) is built with an understanding of the
1336
- `java.lang` package. This means that `T()` references to types within `java.lang` do not need to be
1337
- fully qualified, but all other type references must be. The following example shows how
1338
- to use the `T` operator:
1337
+ `java.lang` package. This means that `T()` references to types within the `java.lang`
1338
+ package do not need to be fully qualified, but all other type references must be. The
1339
+ following example shows how to use the `T` operator:
1339
1340
1340
1341
[source,java,indent=0,subs="verbatim,quotes",role="primary"]
1341
1342
.Java
@@ -1365,9 +1366,10 @@ to use the `T` operator:
1365
1366
[[expressions-constructors]]
1366
1367
=== Constructors
1367
1368
1368
- You can invoke constructors by using the `new` operator. You should use the fully qualified class name
1369
- for all but the types located in the core package `java.lang`. The following
1370
- example shows how to use the `new` operator to invoke constructors:
1369
+ You can invoke constructors by using the `new` operator. You should use the fully
1370
+ qualified class name for all types except those located in the `java.lang` package
1371
+ (`Integer`, `Float`, `String`, and so on). The following example shows how to use the
1372
+ `new` operator to invoke constructors:
1371
1373
1372
1374
[source,java,indent=0,subs="verbatim,quotes",role="primary"]
1373
1375
.Java
@@ -1376,7 +1378,7 @@ example shows how to use the `new` operator to invoke constructors:
1376
1378
"new org.spring.samples.spel.inventor.Inventor('Albert Einstein', 'German')")
1377
1379
.getValue(Inventor.class);
1378
1380
1379
- //create new inventor instance within add method of List
1381
+ // create new Inventor instance within the add() method of List
1380
1382
p.parseExpression(
1381
1383
"Members.add(new org.spring.samples.spel.inventor.Inventor(
1382
1384
'Albert Einstein', 'German'))").getValue(societyContext);
@@ -1388,7 +1390,7 @@ example shows how to use the `new` operator to invoke constructors:
1388
1390
"new org.spring.samples.spel.inventor.Inventor('Albert Einstein', 'German')")
1389
1391
.getValue(Inventor::class.java)
1390
1392
1391
- //create new inventor instance within add method of List
1393
+ // create new Inventor instance within the add() method of List
1392
1394
p.parseExpression(
1393
1395
"Members.add(new org.spring.samples.spel.inventor.Inventor('Albert Einstein', 'German'))")
1394
1396
.getValue(societyContext)
0 commit comments