Print
Value Tests

All equality checks in MVEL are based on value not reference. Therefore the expression foo == 'bar' is the equivalent to foo.equals("bar") in Java.

Testing for Value Emptiness

MVEL provides a special literal for testing for emptiness of a value, cleverly named empty.

For example:

foo == empty

The example expression will be true if the value of foo satisfies any of the requirements of emptiness.

Testing for Null

MVEL allows both the use of the keyword null or nil to represent a null value.

foo == null;
foo == nil; // same as null

Value coercion

MVEL's type coercion system is applied in cases where two incomparable types are presented by attempting to coerce the right value to that of the type of the left value, and then vice-versa.

For example:

"123" == 123;

This expression is true in MVEL because the type coercion system will coerce the untyped number 123 to a String in order to perform the comparison.

Powered by Atlassian Confluence