Class SearchOperator.Builder
java.lang.Object
org.apache.juneau.commons.beanquery.SearchOperator.Builder
- Enclosing class:
- SearchOperator
Builder for
SearchOperator. See the class Javadoc for an example. Start one with
SearchOperator.create(String, String) or SearchOperator.copy().-
Method Summary
Modifier and TypeMethodDescriptionbuild()Builds the immutableSearchOperator.Attaches a typed extension, keyed by its ownClass.Sets the popup help text.maxArgs(int value) Sets the maximum argument count (inclusive), or-1for unbounded.minArgs(int value) Sets the minimum argument count (inclusive).Sets the operator name, including the leading$(e.g.predicate(SearchPredicate value) Attaches the in-memory evaluator for this (custom) operator.typedArgs(boolean value) Opts this (custom) operator's SQL renderer into typed argument values.types(SearchType... value) Sets the value types this operator applies to.
-
Method Details
-
name
Sets the operator name, including the leading$(e.g."$near").- Parameters:
value- The operator name.- Returns:
- This object.
-
help
Sets the popup help text.- Parameters:
value- The help text.- Returns:
- This object.
-
minArgs
Sets the minimum argument count (inclusive).- Parameters:
value- The minimum number of arguments.- Returns:
- This object.
-
maxArgs
Sets the maximum argument count (inclusive), or-1for unbounded.- Parameters:
value- The maximum number of arguments, or-1for no upper bound.- Returns:
- This object.
-
types
Sets the value types this operator applies to.- Parameters:
value- The applicable types, or none to mean "applies to all types".- Returns:
- This object.
-
predicate
Attaches the in-memory evaluator for this (custom) operator.- Parameters:
value- The predicate the in-memory context calls for this operator. Can benull to leave it with no in-memory evaluator.- Returns:
- This object.
-
typedArgs
Opts this (custom) operator's SQL renderer into typed argument values.Built-in value operators (
$eq/$ne/$in/$gt/$gte/$lt/$lte/$between) always receive typed arguments fromQueryResolver. For a custom operator, this flag controls only its SQL renderer: whentrue , a SQL context passesSearchExpression.typedArgs()instead ofSearchExpression.literalArgs(). The in-memorySearchPredicatealways receives literal strings regardless of this flag.- Parameters:
value-true for the SQL renderer to receive typed arguments.- Returns:
- This object.
-
extension
Attaches a typed extension, keyed by its ownClass.This is how a downstream module (for example
juneau-beanquery-sql's SQL renderer) attaches its own metadata to a custom operator without this module (commons) ever depending on that module's types (design ยง5.3). Retrieve it later withSearchOperator.extension(Class).- Type Parameters:
X- The extension type.- Parameters:
type- The extension's class, used as the lookup key. Must not benull .value- The extension value. Can benull .- Returns:
- This object.
-
build
Builds the immutableSearchOperator.- Returns:
- A new, immutable operator.
- Throws:
IllegalArgumentException- Ifnameisnull or blank,helpisnull or blank on a custom operator,minArgsis negative,maxArgsis neither-1nor>= minArgs, or this builder was seeded fromcopy()of a built-in operator andnamehas been changed since.
-