Section E.5. Expressions


E.5. 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.



Java Enterprise in a Nutshell
Java Enterprise in a Nutshell (In a Nutshell (OReilly))
ISBN: 0596101422
EAN: 2147483647
Year: 2004
Pages: 269

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net