O'Reilly logo

Java Enterprise in a Nutshell, Third Edition by William Crawford, Jim Farley

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Expressions

Expressions are simply literals and identifiers assembled together using the various operators described before. A message selector must eventually evaluate to a Boolean value, so its combination of expressions must be structured to result in a Boolean value. Expressions can be grouped in a message selector using parentheses in order to control the order of evaluation.

Arithmetic expressions are composed of arithmetic operators used with numeric literals and identifier values. Arithmetic expressions can be combined to form compound arithmetic expressions. For example:

(userid + 10000) / (callerid - 10000)

Conditional expressions are made up of comparison and logical operators used with numeric, string, or Boolean literals or identifiers and evaluate to TRUE, FALSE, or NULL (i.e., unknown). Conditional expressions can also be combined to form compound conditional expressions. For example:

(JMSType like '%Ack') AND ((userid + 10000) / (callerid - 10000) < 1.0)

Notice that, although the last example includes an arithmetic expression “fragment,” [(userid + 10000) / (callerid - 1000)], it becomes part of a conditional expression when used with a comparison operator with the numeric literal 1.0.

Every complete message selector must be a conditional expression. A message selector that evaluates to TRUE matches the message; one that evaluates to FALSE or NULL does not match the message.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required