Improve documentation for alternative textual operators in SpEL
This commit is contained in:
parent
9eae0ba50e
commit
e97fc7be38
|
@ -16,7 +16,7 @@ The Spring Expression Language supports the following kinds of operators:
|
||||||
The relational operators (equal, not equal, less than, less than or equal, greater than,
|
The relational operators (equal, not equal, less than, less than or equal, greater than,
|
||||||
and greater than or equal) are supported by using standard operator notation.
|
and greater than or equal) are supported by using standard operator notation.
|
||||||
These operators work on `Number` types as well as types implementing `Comparable`.
|
These operators work on `Number` types as well as types implementing `Comparable`.
|
||||||
The following listing shows a few examples of operators:
|
The following listing shows a few examples of relational operators:
|
||||||
|
|
||||||
[tabs]
|
[tabs]
|
||||||
======
|
======
|
||||||
|
@ -67,7 +67,7 @@ in favor of comparisons against zero (for example, `X > 0` or `X < 0`).
|
||||||
====
|
====
|
||||||
|
|
||||||
In addition to the standard relational operators, SpEL supports the `instanceof` and regular
|
In addition to the standard relational operators, SpEL supports the `instanceof` and regular
|
||||||
expression-based `matches` operator. The following listing shows examples of both:
|
expression-based `matches` operators. The following listing shows examples of both:
|
||||||
|
|
||||||
[tabs]
|
[tabs]
|
||||||
======
|
======
|
||||||
|
@ -108,11 +108,11 @@ Kotlin::
|
||||||
|
|
||||||
CAUTION: Be careful with primitive types, as they are immediately boxed up to their
|
CAUTION: Be careful with primitive types, as they are immediately boxed up to their
|
||||||
wrapper types. For example, `1 instanceof T(int)` evaluates to `false`, while
|
wrapper types. For example, `1 instanceof T(int)` evaluates to `false`, while
|
||||||
`1 instanceof T(Integer)` evaluates to `true`, as expected.
|
`1 instanceof T(Integer)` evaluates to `true`.
|
||||||
|
|
||||||
Each symbolic operator can also be specified as a purely alphabetic equivalent. This
|
Each symbolic operator can also be specified as a purely textual equivalent. This avoids
|
||||||
avoids problems where the symbols used have special meaning for the document type in
|
problems where the symbols used have special meaning for the document type in which the
|
||||||
which the expression is embedded (such as in an XML document). The textual equivalents are:
|
expression is embedded (such as in an XML document). The textual equivalents are:
|
||||||
|
|
||||||
* `lt` (`<`)
|
* `lt` (`<`)
|
||||||
* `gt` (`>`)
|
* `gt` (`>`)
|
||||||
|
@ -120,9 +120,7 @@ which the expression is embedded (such as in an XML document). The textual equiv
|
||||||
* `ge` (`>=`)
|
* `ge` (`>=`)
|
||||||
* `eq` (`==`)
|
* `eq` (`==`)
|
||||||
* `ne` (`!=`)
|
* `ne` (`!=`)
|
||||||
* `div` (`/`)
|
* `not` (`!`)
|
||||||
* `mod` (`%`)
|
|
||||||
* `not` (`!`).
|
|
||||||
|
|
||||||
All of the textual operators are case-insensitive.
|
All of the textual operators are case-insensitive.
|
||||||
|
|
||||||
|
@ -136,6 +134,8 @@ SpEL supports the following logical operators:
|
||||||
* `or` (`||`)
|
* `or` (`||`)
|
||||||
* `not` (`!`)
|
* `not` (`!`)
|
||||||
|
|
||||||
|
All of the textual operators are case-insensitive.
|
||||||
|
|
||||||
The following example shows how to use the logical operators:
|
The following example shows how to use the logical operators:
|
||||||
|
|
||||||
[tabs]
|
[tabs]
|
||||||
|
@ -283,6 +283,16 @@ You can use the following operators on numbers, and standard operator precedence
|
||||||
* modulus (`%`)
|
* modulus (`%`)
|
||||||
* exponential power (`^`)
|
* exponential power (`^`)
|
||||||
|
|
||||||
|
The division and modulus operators can also be specified as a purely textual equivalent.
|
||||||
|
This avoids problems where the symbols used have special meaning for the document type in
|
||||||
|
which the expression is embedded (such as in an XML document). The textual equivalents
|
||||||
|
are:
|
||||||
|
|
||||||
|
* `div` (`/`)
|
||||||
|
* `mod` (`%`)
|
||||||
|
|
||||||
|
All of the textual operators are case-insensitive.
|
||||||
|
|
||||||
[NOTE]
|
[NOTE]
|
||||||
====
|
====
|
||||||
The increment and decrement operators can be used with either prefix (`{pp}A`, `--A`) or
|
The increment and decrement operators can be used with either prefix (`{pp}A`, `--A`) or
|
||||||
|
|
Loading…
Reference in New Issue