Enum Class CountPolicy
- All Implemented Interfaces:
Serializable,Comparable<CountPolicy>,Constable
find / findValues call computes alongside its page of rows.
Set on BeanQueryContext.Builder.countPolicy(CountPolicy) and overridable per session with
BeanQuerySession.Builder.countPolicy(CountPolicy). Counts can cost extra queries (two COUNT(*)
statements on a SQL engine), so the default IF_REQUESTED lets the caller opt in while the server keeps
the final say. BeanQuerySession.count(BeanQuery) always computes both counts regardless of the policy.
Example:
- Since:
- 10.0.0
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionCompute both the total count (rows that pass the guards) and the matched count.Compute only the matched count (rows that pass the guards and the search).Never compute counts;Page.total()andPage.matched()are empty. -
Method Summary
Modifier and TypeMethodDescriptionstatic CountPolicyReturns the enum constant of this class with the specified name.static CountPolicy[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
NONE
Never compute counts;Page.total()andPage.matched()are empty. -
MATCHED
Compute only the matched count (rows that pass the guards and the search). -
BOTH
Compute both the total count (rows that pass the guards) and the matched count. -
IF_REQUESTED
Let the query decide through itsopts:counts=matched→MATCHED;counts=bothorcounts=true→BOTH; anything else →NONE.A
resolved querynever carries this value; it is always replaced by one of the other three.
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-