Class BeanQueryContext.Builder<T,SELF extends BeanQueryContext.Builder<T,SELF>>
java.lang.Object
org.apache.juneau.commons.beanquery.BeanQueryContext.Builder<T,SELF>
- Type Parameters:
T- The row type.SELF- The concrete builder type, returned by every setter.
- Direct Known Subclasses:
InMemoryBeanQueryContext.Builder,SqlBeanQueryContext.Builder
- Enclosing class:
- BeanQueryContext<T>
public abstract static class BeanQueryContext.Builder<T,SELF extends BeanQueryContext.Builder<T,SELF>>
extends Object
The settings every engine's context builder shares.
Single-argument problems throw IllegalArgumentException from the setter. Missing or conflicting settings
throw IllegalStateException from build().
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedBuilder()Constructor for a new, empty builder.protectedBuilder(BeanQueryContext<T> copyFrom) Copy constructor. -
Method Summary
Modifier and TypeMethodDescriptionallowRegex(boolean value) Allows the$regexoperator.abstract BeanQueryContext<T>build()Builds the immutable context.column(String name, SearchType type) Declares a column, or changes the type of a declared one (keeping its position).columnOperators(String column, SearchOperatorSet value) Replaces the operator set for one declared column.Keeps only the specified declared columns, in the specified order.countPolicy(CountPolicy value) Sets which countsfind/findValuescompute.protected final StringChecks that a column is declared.defaultLimit(int value) Sets the limit used when a query has none.Removes declared columns (and any operator override on them).maxExpressionDepth(int value) Sets the deepest allowed expression nesting.Sets the largest limit a query can ask for; larger limits andlimit=-1are clamped to it.maxSearchClauses(int value) Sets the largest number of search clauses.maxSearchLength(int value) Sets the longest search, sort, view or opts string.maxSortKeys(int value) Sets the largest number of sort keys.operators(SearchOperatorSet value) Sets the default operator set (for columns without an override).regexTimeout(Duration value) Sets the time budget for all$regexmatching in one session call.protected final SELFself()Returns this builder as its concrete type.
-
Constructor Details
-
Builder
protected Builder()Constructor for a new, empty builder. -
Builder
Copy constructor.- Parameters:
copyFrom- The context whose settings are copied. Must not benull .
-
-
Method Details
-
self
Returns this builder as its concrete type.- Returns:
- This object.
-
column
Declares a column, or changes the type of a declared one (keeping its position).- Parameters:
name- The column name. Must not be blank.type- The column's value type. Must not benull .- Returns:
- This object.
-
columns
Keeps only the specified declared columns, in the specified order.- Parameters:
names- The column names. Each must already be declared.- Returns:
- This object.
-
exclude
Removes declared columns (and any operator override on them).- Parameters:
names- The column names. Each must be declared.- Returns:
- This object.
-
declared
Checks that a column is declared.- Parameters:
name- The column name.- Returns:
- The same name.
- Throws:
IllegalArgumentException- If the column is not declared.
-
operators
Sets the default operator set (for columns without an override). Default:SearchOperatorSet.standard().- Parameters:
value- The operator set. Must not benull .- Returns:
- This object.
-
columnOperators
Replaces the operator set for one declared column.- Parameters:
column- The column name. Must be declared.value- The operator set. Must not benull .- Returns:
- This object.
-
allowRegex
Allows the$regexoperator. Default:true ;allowRegex(false)disables it.- Parameters:
value- The new value.- Returns:
- This object.
-
regexTimeout
Sets the time budget for all$regexmatching in one session call. Default: 50 ms.- Parameters:
value- The budget. Must be positive.- Returns:
- This object.
-
countPolicy
- Parameters:
value- The policy. Must not benull .- Returns:
- This object.
-
defaultLimit
Sets the limit used when a query has none. Default: 100.- Parameters:
value- The limit. Must be positive.- Returns:
- This object.
-
maxLimit
Sets the largest limit a query can ask for; larger limits andlimit=-1are clamped to it. Default: 1000.If this builder's
defaultLimitwas never explicitly set (it is stillQuerySettings's own baseline default, or — for a builder fromBeanQueryContext.copy()— still whatever the source context had), narrowingmaxLimitbelow it auto-narrowsdefaultLimitto match, rather than leaving the two in conflict. An explicitly-chosendefaultLimitis never silently changed by this setter — a resulting conflict is left forbuild()to reject.- Parameters:
value- The cap, ornull for no cap. Must be positive if set.- Returns:
- This object.
-
maxSearchClauses
Sets the largest number of search clauses. Default: 64.- Parameters:
value- The cap. Must be positive.- Returns:
- This object.
-
maxSortKeys
Sets the largest number of sort keys. Default: 8.- Parameters:
value- The cap. Must be positive.- Returns:
- This object.
-
maxSearchLength
Sets the longest search, sort, view or opts string. Default: 4096.- Parameters:
value- The cap. Must be positive.- Returns:
- This object.
-
maxExpressionDepth
Sets the deepest allowed expression nesting. Default: 16.- Parameters:
value- The cap. Must be positive.- Returns:
- This object.
-
build
Builds the immutable context.- Returns:
- A new context.
- Throws:
IllegalStateException- If a required setting is missing or two settings conflict.
-