Class SearchExpression
SearchExpressionParser: the resolved, validated form of a column's
$-search expression that a context walks to filter rows or build SQL.
A node is one of two shapes:
- A literal (
isLiteral()): a bare pattern token or a literal argument of a leaf operator (for exampleOPENin$eq(OPEN)). Its text isvalue(); it has noargs(). - A function (
isFunction()): a$-operator invocation. Itsname()is the$-name,operator()is the resolvedSearchOperator, andargs()are the argument nodes — literal nodes for a leaf operator, or nested function nodes for a combinator.
This tree is the parser's output, not a wire format: a BeanQuery carries only raw expression strings, and
engines call the parser themselves. See SearchExpressionParser.
Example:
SearchExpression
Example (typed values):
SearchExpression
- Since:
- 10.0.0
-
Method Summary
Modifier and TypeMethodDescriptionintargCount()The number of argument nodes.args()The argument nodes (empty for a literal or a zero-arg function such as$blank()).booleaninthashCode()booleanWhether this is a$-operator invocation.booleanWhether this is a literal (a bare pattern token or a leaf argument).booleanisQuoted()Whether this literal was written as a quoted value ("a*"or'a*') in the search string.This function's arguments as literal strings — the shape a leaf operator (built-in or custom) consumes.name()The operator$-name, ornull for a literal.operator()The resolved operator, ornull for a literal.toString()This function's arguments'typed values, in order - the shape a value operator, or a custom operator opting intotypedArgs(true), consumes instead ofliteralArgs().The parsed, type-aware value for this node.value()The literal text, ornull for a function.
-
Method Details
-
isLiteral
Whether this is a literal (a bare pattern token or a leaf argument).- Returns:
true if a literal.
-
isFunction
Whether this is a$-operator invocation.- Returns:
true if a function.
-
name
The operator$-name, ornull for a literal.- Returns:
- The name, or
null .
-
value
The literal text, ornull for a function.- Returns:
- The value, or
null .
-
isQuoted
Whether this literal was written as a quoted value ("a*"or'a*') in the search string.A quoted literal is never wildcard-interpreted:
name="a*"matches the literal texta*(case-insensitive substring, like any bare value without wildcards), whilename=a*treats*as a wildcard. Alwaysfalse for a function node.- Returns:
true if this literal was quoted in the source search string.
-
operator
The resolved operator, ornull for a literal.- Returns:
- The operator, or
null .
-
args
The argument nodes (empty for a literal or a zero-arg function such as$blank()).- Returns:
- An unmodifiable list of argument nodes.
-
argCount
The number of argument nodes.- Returns:
- The argument count.
-
literalArgs
This function's arguments as literal strings — the shape a leaf operator (built-in or custom) consumes.A non-literal (nested function) argument contributes its
$-name so the list length always equalsargCount().- Returns:
- An unmodifiable list of the literal argument strings.
-
typedValue
The parsed, type-aware value for this node.For a literal node that
QueryResolvertyped (a bare literal, or an argument of a value operator such as$eq/$in/$gt/$between), this is theparsedobject (BigDecimal,Boolean, or ajava.timetype). For every other node (untyped literals, function nodes) this returnsvalue()unchanged, so callers can readtypedValue()instead ofvalue()without a null check.- Returns:
- The typed value, or the literal text.
-
typedArgs
This function's arguments'typed values, in order - the shape a value operator, or a custom operator opting intotypedArgs(true), consumes instead ofliteralArgs().A nested function argument contributes its
$-name, exactly as inliteralArgs(), so the list never containsnull for a function argument and its length always equalsargCount().- Returns:
- An unmodifiable list of the typed argument values, one per
args()entry.
-
equals
-
hashCode
-
toString
-