Interface LogicalExpression
- All Known Implementing Classes:
FilterQuery, FunctionCall.Logical, FunctionCall.Nodes, LogicalExpression.And, LogicalExpression.Comparison, LogicalExpression.Not, LogicalExpression.Or
public sealed interface LogicalExpression
permits LogicalExpression.Or, LogicalExpression.And, LogicalExpression.Not, LogicalExpression.Comparison, FilterQuery, FunctionCall.Logical, FunctionCall.Nodes
An expression with a logical result: LogicalTrue or LogicalFalse (RFC 9535, Section 2.3.5).
| Expression | Query text | True if |
|---|---|---|
LogicalExpression.Or |
@.a || @.b |
an operand is true |
LogicalExpression.And |
@.a && @.b |
all operands are true |
LogicalExpression.Not |
!@.a, !(@.a == 1) |
the operand is false |
LogicalExpression.Comparison |
@.price < 10 |
the comparison is true (Section 2.3.5.2.2) |
FilterQuery |
@.isbn, $.config.debug |
the query selects at least one node (existence test) |
FunctionCall.Logical |
match(@.date, '1974-.*') |
the function gives LogicalTrue |
FunctionCall.Nodes |
myNodes(@.*) |
the nodelist of the function is not empty (Section 2.4.2) |
The operator precedence is: parentheses and functions, then !, then comparisons, then &&,
then ||. Thus the parser makes @.a || @.b && @.c into Or[a, And[b, c]]. A tree does not
keep parentheses: the structure of the tree gives the grouping.
An existence test is true also for a node with the value null or false. To test the value,
use a comparison, for example @.debug == true.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic final recordA conjunction:a && b && ....static final recordA comparison:left op right(Section 2.3.5.2.2).static final recordA negation:!a.static final recordA disjunction:a || b || ....