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 the arguments.
    • getFirstArg

      io.github.mmm.value.CriteriaObject<?> getFirstArg()
      Returns:
      the first argument of the arguments.
      See Also:
    • getSecondArg

      io.github.mmm.value.CriteriaObject<?> getSecondArg()
      Returns:
      the second argument of the arguments or null if not present (e.g. in case of unary CriteriaExpression like NOT(expression)).
      See Also:
    • getArgs

      List<? extends io.github.mmm.value.CriteriaObject<?>> getArgs()
      Returns:
      the Collection of arguments. Use getArgCount() to check if only 1 or 2 arguments are present to avoid creation of Collection.
    • getArgCount

      default int getArgCount()
      Returns:
      the number of arguments.
    • 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)
      Here we assume that e1, e2, and e3 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.