Enum OPERATOR

    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
      AND
      Not an operator, it is here to support " AND " syntax in user values
      BETWEEN  
      EQ  
      GE  
      GT  
      IN  
      ISBLANK
      case-insensitive user input
      ISEMPTY
      for empty collection! case-insensitive user input
      ISNOTBLANK
      case-insensitive user input
      ISNOTEMPTY
      for empty collection! case-insensitive user input
      ISNOTNULL
      case-insensitive user input
      ISNULL
      case-insensitive user input
      LE  
      LIKE  
      LT  
      MEMBEROF  
      NE  
      OR
      Not an operator, it is here to support " OR " syntax in user values
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static char NEGATION  
    • Enum Constant Detail

      • LIKE

        public static final OPERATOR LIKE
      • MEMBEROF

        public static final OPERATOR MEMBEROF
      • BETWEEN

        public static final OPERATOR BETWEEN
      • ISNULL

        public static final OPERATOR ISNULL
        case-insensitive user input
      • ISNOTNULL

        public static final OPERATOR ISNOTNULL
        case-insensitive user input
      • ISBLANK

        public static final OPERATOR ISBLANK
        case-insensitive user input
      • ISNOTBLANK

        public static final OPERATOR ISNOTBLANK
        case-insensitive user input
      • ISEMPTY

        public static final OPERATOR ISEMPTY
        for empty collection! case-insensitive user input
      • ISNOTEMPTY

        public static final OPERATOR ISNOTEMPTY
        for empty collection! case-insensitive user input
      • AND

        public static final OPERATOR AND
        Not an operator, it is here to support " AND " syntax in user values
      • OR

        public static final OPERATOR OR
        Not an operator, it is here to support " OR " syntax in user values
    • Method Detail

      • values

        public static OPERATOR[] 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 (OPERATOR c : OPERATOR.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static OPERATOR 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
      • negation

        public static boolean negation​(String value)
        check if a string (user value) indicates a negation
        Parameters:
        value -
        Returns:
        See Also:
        NEGATION
      • stripSyntax

        public static String stripSyntax​(String value)
        Strip !, <, >, = at the beginning of a value in order to get the raw user supplied value.
        Parameters:
        value -
        Returns:
      • eq

        public static boolean eq​(String value)
        check if a string (user value) indicates a greater/smaller than or equal comparison
        Parameters:
        value -
        Returns:
        See Also:
        GE, LE
      • greater

        public static boolean greater​(String value)
        check if a string (user value) indicates a greater than comparison
        Parameters:
        value -
        Returns:
        See Also:
        GT
      • smaller

        public static boolean smaller​(String value)
        check if a string (user value) indicates a smaller than comparison.
        Parameters:
        value -
        Returns:
        See Also:
        LT
      • valueIsOperator

        public static boolean valueIsOperator​(String s,
                                              boolean syntaxInValue)
        users may input "(!)is null", "(!)is empty", "(!)is blank", in that case there is no parameter value to be set for a key.
        Parameters:
        s -
        syntaxInValue -
        Returns:
      • isBetween

        public static boolean isBetween​(String value)
      • isAnd

        public static boolean isAnd​(String value)
        true when " AND " is found in the given string and it comes before an optional " OR " and there are at least two terms
        Parameters:
        value -
        Returns:
      • isOr

        public static boolean isOr​(String value)
        true when " OR " is found in the given string and it comes before an optional " AND " and there are at least two terms
        Parameters:
        value -
        Returns:
      • operator

        public static OPERATOR operator​(String operator,
                                        String value,
                                        boolean syntaxInValue)
        Returns an operator from the value when syntaxInValue is true and the value contains one of the supported operators, otherwise the operator is determined from the operator argument
        Parameters:
        operator -
        value -
        syntaxInValue -
        Returns:
      • toString

        public String toString()
        returns the token wrapped in spaces, so string concatenation in query building can be used.
        Overrides:
        toString in class Enum<OPERATOR>
        Returns:
      • getToken

        public String getToken()
      • getUserInput

        public String getUserInput()
        When null the OPERATOR cannot be determined from user input
        Returns:
      • isOperatorInUserInput

        public boolean isOperatorInUserInput​(String input)
        Is this operator in user input
        Parameters:
        input -
        Returns:
      • fromUserInput

        public static OPERATOR fromUserInput​(String input)
      • operatorInUserInput

        public static boolean operatorInUserInput​(String input)
        Does user input contain an operator
        Parameters:
        input -
        Returns:
        See Also:
        isOperatorInUserInput(String)