From 917948deac778b96bb2e5fb9784e9265fa6d8d95 Mon Sep 17 00:00:00 2001 From: Stephane Nicoll Date: Fri, 27 May 2016 10:30:38 +0200 Subject: [PATCH] Polish SpEL documentation Issue: SPR-14243 --- src/asciidoc/core-expressions.adoc | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/asciidoc/core-expressions.adoc b/src/asciidoc/core-expressions.adoc index 3052d3d969..7bdca9b793 100644 --- a/src/asciidoc/core-expressions.adoc +++ b/src/asciidoc/core-expressions.adoc @@ -785,7 +785,7 @@ expression based `matches` operator. ---- // evaluates to false boolean falseValue = parser.parseExpression( - "'xyz' instanceof T(int)").getValue(Boolean.class); + "'xyz' instanceof T(Integer.class)").getValue(Boolean.class); // evaluates to true boolean trueValue = parser.parseExpression( @@ -796,6 +796,13 @@ expression based `matches` operator. "'5.0067' matches '\^-?\\d+(\\.\\d{2})?$'").getValue(Boolean.class); ---- +[NOTE] +==== +Be careful with primitive types as they are immediately boxed up to the wrapper type, +so `1 instanceof T(int)` evaluates to `false` while `1 instanceof T(Integer.class)` +evaluates to `true`, as expected. +==== + Each symbolic operator can also be specified as a purely alphabetic equivalent. This avoids problems where the symbols used have special meaning for the document type in which the expression is embedded (eg. an XML document). The textual equivalents are