Class CriteriaCheck
Every way a criterion can be wrong ends the same way without this: the query runs, matches nothing or everything, and answers. A filter that quietly stopped filtering is the one wrong answer a caller cannot notice, so the shape, the names and the values are settled here, once, and what builds the query afterwards can assume they hold.
It is shared rather than written per tool because each tool that takes criteria would otherwise re-derive the same rules, and the ones that got them wrong got them wrong quietly. What differs between tools is only which operators they can express, which each passes in.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordA field a criterion may match against.static interfaceWhat a tool knows about the fields a criterion may name. -
Method Summary
Modifier and TypeMethodDescriptionstatic OperatoroperatorOf(Criterion criterion) The operator a criterion names, whichever of its two spellings was used.static voidvalidate(Criterion criteria, String modelName, CriteriaCheck.Fields fields, Set<Operator> supported) Refuses criteria this tool cannot answer truthfully.
-
Method Details
-
validate
public static void validate(Criterion criteria, String modelName, CriteriaCheck.Fields fields, Set<Operator> supported) Refuses criteria this tool cannot answer truthfully.- Parameters:
modelName- the model as the caller named it, for what is reported backfields- what the model's fields are and what they acceptsupported- the leaf operators this tool can express- Throws:
IllegalArgumentException- naming what is wrong and what would be right
-
operatorOf
The operator a criterion names, whichever of its two spellings was used.=andequalsare one operator, as areandandAND:Operatoraccepts both, so anything reading criteria has to accept both too, or it refuses a spelling the rest of the platform takes.
-