Chapter 4. Expressions

Table of Contents

Constants
Referring to Properties
Indexing
Array and List Indexing
JavaBeans Indexed Properties
OGNL Object Indexed Properties
Calling Methods
Variable References
Parenthetical Expressions
Chained Subexpressions
Collection Construction
Lists
Native Arrays
Maps
Projecting Across Collections
Selecting From Collections
Selecting First Match
Selecting Last Match
Calling Constructors
Calling Static Methods
Getting Static Fields
Expression Evaluation
Pseudo-Lambda Expressions
Pseudo-Properties for Collections
Operators that differ from Java's operators
Setting values versus getting values

This section outlines the details the elements of OGNL's expressions.

Constants

OGNL has the following kinds of constants:

  • String literals, as in Java (with the addition of single quotes): delimited by single- or double-quotes, with the full set of character escapes.

  • Character literals, also as in Java: delimited by single-quotes, also with the full set of escapes.

  • Numeric literals, with a few more kinds than Java. In addition to Java's ints, longs, floats and doubles, OGNL lets you specify BigDecimals with a "b" or "B" suffix, and BigIntegers with an "h" or "H" suffix (think "huge"---we chose "h" for BigIntegers because it does not interfere with hexadecimal digits).

  • Boolean (true and false) literals.

  • The null literal.