Package com.axelor.ai.tool.system
Record Class Criterion
java.lang.Object
java.lang.Record
com.axelor.ai.tool.system.Criterion
- Record Components:
fieldName- the field to match, a dotted path for a field of a related modeloperator- what to test, or how to joincriteriavalue- what to match against; the lower bound of abetweenvalue2- the upper bound of abetweenornotBetweencriteria- the conditions anand,orornotjoins
public record Criterion(String fieldName, String operator, Object value, Object value2, List<Criterion> criteria)
extends Record
One filter condition, or a group of them.
A leaf names a field, an operator and what to match against. A compound names one of
and, or or not and the conditions it joins, nested as deeply as the caller
needs.
It is a record rather than a free-form map so that the shape a tool accepts is stated once, in the type that reads it: what the model is told it may send is generated from this, and a key that is not here is refused rather than quietly ignored.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncriteria()Returns the value of thecriteriarecord component.final booleanIndicates whether some other object is "equal to" this one.Returns the value of thefieldNamerecord component.final inthashCode()Returns a hash code value for this object.operator()Returns the value of theoperatorrecord component.toMap()The same condition as the map the query layer parses.final StringtoString()Returns a string representation of this record class.value()Returns the value of thevaluerecord component.value2()Returns the value of thevalue2record component.withCriteria(List<Criterion> nested) The same condition with different nested ones.withFieldName(String name) The same condition with a different field name, for a tool that rewrites paths.
-
Constructor Details
-
Method Details
-
toMap
The same condition as the map the query layer parses.Criteriareads a map, so the typed shape is turned back into one at the edge rather than the tool keeping a map around to avoid it. Only what was given is included: a key present with a null value is not the same to that parser as a key left out. -
withFieldName
The same condition with a different field name, for a tool that rewrites paths. -
withCriteria
The same condition with different nested ones. -
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
fieldName
Returns the value of thefieldNamerecord component.- Returns:
- the value of the
fieldNamerecord component
-
operator
Returns the value of theoperatorrecord component.- Returns:
- the value of the
operatorrecord component
-
value
Returns the value of thevaluerecord component.- Returns:
- the value of the
valuerecord component
-
value2
Returns the value of thevalue2record component.- Returns:
- the value of the
value2record component
-
criteria
Returns the value of thecriteriarecord component.- Returns:
- the value of the
criteriarecord component
-