Enum CmpOperator

    • Enum Constant Detail

      • EQUAL

        public static final CmpOperator EQUAL
        the "equals" operator
      • NOT_EQUAL

        public static final CmpOperator NOT_EQUAL
        the "not equals" operator
      • GREATER_THAN

        public static final CmpOperator GREATER_THAN
        the "greater than" operator
      • GREATER_THAN_OR_EQUAL

        public static final CmpOperator GREATER_THAN_OR_EQUAL
        the "greater than or equal" operator
      • LESS_THAN

        public static final CmpOperator LESS_THAN
        the "less than" operator
      • LESS_THAN_OR_EQUAL

        public static final CmpOperator LESS_THAN_OR_EQUAL
        the "less than or equal" operator
      • LIKE

        public static final CmpOperator LIKE
        The "like" operator works like SQL's LIKE operator. _ is a placeholder for exactly one character; % is a placeholder for an arbitrary number of characters (even zero). Only works on strings.
      • NOT_LIKE

        public static final CmpOperator NOT_LIKE
        A negated LIKE operator. Only works on strings.
      • LIKE_IGNORECASE

        public static final CmpOperator LIKE_IGNORECASE
        A case insensitive version of LIKE. When not using any placeholders this operator works like a case insensitive EQUAL. Only works on strings.
      • NOT_LIKE_IGNORECASE

        public static final CmpOperator NOT_LIKE_IGNORECASE
        A case insensitive version of NOT_LIKE. When not using any placeholders this operator works like a case insensitive NOT_EQUAL. Only works on strings.
    • Method Detail

      • values

        public static CmpOperator[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (CmpOperator c : CmpOperator.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static CmpOperator valueOf​(String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
        Parameters:
        name - the name of the enum constant to be returned.
        Returns:
        the enum constant with the specified name
        Throws:
        IllegalArgumentException - if this enum type has no constant with the specified name
        NullPointerException - if the argument is null
      • getSymbol

        public String getSymbol()
        Returns this comparison operator's associated symbol.
        Returns:
        this comparison operator's associated symbol
      • getCmpOperatorForSymbol

        public static CmpOperator getCmpOperatorForSymbol​(String symbol)
        Returns the comparison operator to which the given symbol belongs or null if the symbol is not recognised.
        Parameters:
        symbol - the symbol for which to find the comparison operator
        Returns:
        the comparison operator for this symbol or null
      • canCompare

        public boolean canCompare​(DataType dataType)
        Returns whether this comparison operator can generally work on the given data type. If it can, this at least guarantees that it can compare two values of this same type. If the parameter is null this method will determine if the operator can deal with null values (at the time of writing, only EQUAL and NOT_EQUAL can do that).
        Parameters:
        dataType - the data type to be tested
        Returns:
        whether this comparison operator can generally work on the given data type
      • canCompare

        public boolean canCompare​(DataType columnDataType,
                                  DataType valueDataType)
        Returns whether this operator can compare the two given data types. The left-hand data type is the data type of a column and must therefore never be null. The right-hand data type is the data type of the value or null if the value itself is null. At the time of writing, only EQUAL and NOT_EQUAL can compare a null-value to the value of a column.
        Parameters:
        columnDataType - the left-hand data type (which should be the column's data type)
        valueDataType - the right-hand data type (which should be the value object's data type or null)
        Returns:
        whether this operator can compare the two given data types