Class DFTermExpression


  • public final class DFTermExpression
    extends DFTerm
    This object represents a complex expression. It consists of operator and zero to more operands. In addition it can contain some options which are specific parameters to this expression. These options are not standardized.

    The object is immutable, the value cannot be changed once the object is created. Currently it doesn't have public constructor nor create method. If you want to use this object you can create using DFTermsFactory static methods.

    Author:
    Petr Hamernik
    • Field Detail

      • ALL_DATA

        public static final DFTermExpression ALL_DATA
        The constant which represents all data. In SQL it means "SELECT * FROM SOME_TABLE".
    • Method Detail

      • isAllData

        public boolean isAllData()
        Tells if this query represents "all data" query.
        Returns:
        true if this query is "all data" ~ without an operand.
        Since:
        19.20.0
        See Also:
        ALL_DATA
      • changeOperator

        public DFTermExpression changeOperator​(DFOperator newOperator)
        Change the operator for this expression and return new changed instance of this expression.
        Parameters:
        newOperator - New operator must be only in the same group of operators. If the previous operator was logical (AND/OR), the new one must be from the same category otherwise the method will throw an exception. The same for structural operators.
        Returns:
        New expression with the same operands and the same options.
      • changeOptions

        public DFTermExpression changeOptions​(java.util.Map<java.lang.String,​java.lang.Object> newOptions)
        Change the options of this expression. As this object immutable it returns a new instance with changed options
        Parameters:
        newOptions - New options
        Returns:
        The new instance of DFTermExpression with replaced options.
      • getOperator

        public DFOperator getOperator()
        Gets the operator.
        Returns:
        Operator for this expression. Never returns null.
      • getOperands

        public java.util.List<DFTerm> getOperands()
        Gets the list of operands.
        Returns:
        The list of operands. Never returns null.
      • getIndexOfOperand

        public int getIndexOfOperand​(DFTerm operand)
        Get index of the operand.
        Parameters:
        operand - The operand which you are looking for
        Returns:
        The index of the given operand or -1 if the operand cannot be found.
      • getOptions

        public java.util.Map<java.lang.String,​java.lang.Object> getOptions()
        Gets the options of the expression.
        Returns:
        The options
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object