Skip to content

Commit b01adad

Browse files
committed
Improve documentation for SpEL property reference syntax
See gh-25538
1 parent 9c11887 commit b01adad

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed

src/docs/asciidoc/core/core-expressions.adoc

+15-7
Original file line numberDiff line numberDiff line change
@@ -803,22 +803,30 @@ expressions:
803803
.Java
804804
----
805805
// evals to 1856
806-
int year = (Integer) parser.parseExpression("Birthdate.Year + 1900").getValue(context);
806+
int year = (Integer) parser.parseExpression("birthdate.year + 1900").getValue(context);
807807
808-
String city = (String) parser.parseExpression("placeOfBirth.City").getValue(context);
808+
String city = (String) parser.parseExpression("placeOfBirth.city").getValue(context);
809809
----
810810
[source,kotlin,indent=0,subs="verbatim,quotes",role="secondary"]
811811
.Kotlin
812812
----
813813
// evals to 1856
814-
val year = parser.parseExpression("Birthdate.Year + 1900").getValue(context) as Int
814+
val year = parser.parseExpression("birthdate.year + 1900").getValue(context) as Int
815815
816-
val city = parser.parseExpression("placeOfBirth.City").getValue(context) as String
816+
val city = parser.parseExpression("placeOfBirth.city").getValue(context) as String
817817
----
818818

819-
Case insensitivity is allowed for the first letter of property names. The contents of
820-
arrays and lists are obtained by using square bracket notation, as the following example
821-
shows:
819+
[NOTE]
820+
====
821+
Case insensitivity is allowed for the first letter of property names. Thus, the
822+
expressions in the above example may be written as `Birthdate.Year + 1900` and
823+
`PlaceOfBirth.City`, respectively. In addition, properties may optionally be accessed via
824+
method invocations -- for example, `getPlaceOfBirth().getCity()` instead of
825+
`placeOfBirth.city`.
826+
====
827+
828+
The contents of arrays and lists are obtained by using square bracket notation, as the
829+
following example shows:
822830

823831
[source,java,indent=0,subs="verbatim,quotes",role="primary"]
824832
.Java

0 commit comments

Comments
 (0)