Class DFTermsFactory


  • public final class DFTermsFactory
    extends java.lang.Object
    The factory class for creating DFTerms. This class has only limited methods which creates only expression of some specific patterns which are currently supported by DIF execution. So it's not possible to create DFTermExpression which DIF implementation is not able to execute.

    It's very likely that this class will contain more create methods in the future.

    Author:
    Petr Hamernik
    • Method Detail

      • createFieldOperatorValueExpr

        public static DFTermExpression createFieldOperatorValueExpr​(DFOperator operator,
                                                                    DFField field,
                                                                    java.util.Map<java.lang.String,​java.lang.Object> options,
                                                                    java.lang.Object... values)
        Create the basic "Field operator Value(s)" expression. The number of values depends on the type of operator you use. Some operators are unary (accepts only one operand which is the field... e.g. NULL operator), some other are binary (less than,...) and some accepts many operands (e.g. IN LIST).
        Parameters:
        operator - The operator
        field - The field (will be used as the first operand)
        options - Options of the expression, can be null (empty Map is created then)
        values - Constant values - the number should match with the operator arity.
        Returns:
        The new expression term based on the given arguments. Never returns null.
      • createExprAndOr

        public static DFTermExpression createExprAndOr​(DFOperator operator,
                                                       java.util.List<DFTermExpression> childExpressions,
                                                       java.util.Map<java.lang.String,​java.lang.Object> options)
        Creates the AND or OR expression (e.g. (id = 5) OR (atomcount = 10))
        Parameters:
        operator - Operator for this expression. Only allowed values are Operators.AND and Operators.OR. You can use Operators.isAndOr(DFOperator) method to test your operator. If other operator is specified this method throws IllegalArgumentException.
        childExpressions - One or more child expressions. Currently accepts only DFTermExpressions.
        options - Options of the expression
        Returns:
        The new AND/OR expression term based on the given arguments. Never returns null.
      • mergeDomainFilterWithExpression

        public static DFTermExpression mergeDomainFilterWithExpression​(DFTermExpression expr,
                                                                       DFSearchDomain domain)
        When DFSearchDomain is used this method adds a new IN LIST expression with domain's ids to given expression set.
        Parameters:
        expr - Original expression
        domain - Original search domain
        Returns:
        New merged DFTermExpression