Module io.github.mmm.property
Package io.github.mmm.property.criteria
Interface CriteriaExpression<R>
- Type Parameters:
R
- type of the result value this expression evaluates to.
- All Superinterfaces:
io.github.mmm.value.CriteriaObject<R>
- All Known Subinterfaces:
CriteriaAggregation<R>
,CriteriaPredicate
public interface CriteriaExpression<R>
extends io.github.mmm.value.CriteriaObject<R>
Interface for a search criteria. Can be e.g. used to build dynamic queries (see
mmm-entity-db
). Use
CriteriaFormatter
and its sub-classes to convert to database syntax (e.g. SQL) and
CriteriaMarshalling
to (un)marshall to JSON, XML, etc.- Since:
- 1.0.0
-
Method Details
-
getOperator
CriteriaOperator getOperator()- Returns:
- the
PredicateOperator
used to compare thearguments
.
-
getFirstArg
io.github.mmm.value.CriteriaObject<?> getFirstArg() -
getSecondArg
io.github.mmm.value.CriteriaObject<?> getSecondArg()- Returns:
- the second argument of the
arguments
ornull
if not present (e.g. in case of unaryCriteriaExpression
likeNOT(expression)
). - See Also:
-
getArgs
List<? extends io.github.mmm.value.CriteriaObject<?>> getArgs()- Returns:
- the
Collection
of arguments. UsegetArgCount()
to check if only 1 or 2 arguments are present to avoid creation ofCollection
.
-
getArgCount
default int getArgCount() -
simplify
CriteriaExpression<R> simplify()Simplifies this expression. The following table shows some examples:exp
exp.simplify()
NOT(NOT(e1)) e1 NOT(IS NOT NULL(e.Name)) IS NULL(e.Name) e1 AND (e2 AND e3) e1 AND e2 AND e3 e1 AND (e2 OR e3) e1 AND (e2 OR e3) e1
,e2
, ande3
are simplified expressions. The last example shows an expression that can not be simplified anymore.- Returns:
- a simplified form of this expression or this instance itself if already simplified.
-