Enum Class OPERATOR

java.lang.Object
java.lang.Enum<OPERATOR>
org.fryske_akademy.jpa.OPERATOR
All Implemented Interfaces:
Serializable, Comparable<OPERATOR>, Constable

public enum OPERATOR extends Enum<OPERATOR>
A series of operators supported by this library, encapsulates all intelligence around them. Some of the operators may be determined from user input, for these getUserInput() } has a value.
See Also:
  • Nested Class Summary

    Nested classes/interfaces inherited from class java.lang.Enum

    Enum.EnumDesc<E extends Enum<E>>
  • Enum Constant Summary

    Enum Constants
    Enum Constant
    Description
    Not an operator, it is here to support " AND " syntax in user values
     
     
     
     
     
    case-insensitive user input
    for empty collection! case-insensitive user input
    case-insensitive user input
    for empty collection! case-insensitive user input
    case-insensitive user input
    case-insensitive user input
     
     
     
     
     
    Not an operator, it is here to support " OR " syntax in user values
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final char
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static boolean
    eq(String value)
    check if a string (user value) indicates a greater/smaller than or equal comparison
    static OPERATOR
     
    static OPERATOR
     
     
    When null the OPERATOR cannot be determined from user input
    static boolean
    greater(String value)
    check if a string (user value) indicates a greater than comparison
    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
    static boolean
     
    boolean
    Is this operator in user input
    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
    static boolean
    check if a string (user value) indicates a negation
    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
    static boolean
    Does user input contain an operator
    static boolean
    smaller(String value)
    check if a string (user value) indicates a smaller than comparison.
    static String
    Strip !, <, >, = at the beginning of a value in order to get the raw user supplied value.
    returns the token wrapped in spaces, so string concatenation in query building can be used.
    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.
    static OPERATOR
    Returns the enum constant of this class with the specified name.
    static OPERATOR[]
    Returns an array containing the constants of this enum class, in the order they are declared.

    Methods inherited from class java.lang.Object

    getClass, notify, notifyAll, wait, wait, wait
  • Enum Constant Details

    • EQ

      public static final OPERATOR EQ
    • GT

      public static final OPERATOR GT
    • LT

      public static final OPERATOR LT
    • GE

      public static final OPERATOR GE
    • LE

      public static final OPERATOR LE
    • IN

      public static final OPERATOR IN
    • LIKE

      public static final OPERATOR LIKE
    • NE

      public static final OPERATOR NE
    • 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
  • Field Details

  • Method Details

    • values

      public static OPERATOR[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static OPERATOR valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (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 class 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:
    • 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:
    • greater

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

      public static boolean smaller(String value)
      check if a string (user value) indicates a smaller than comparison.
      Parameters:
      value -
      Returns:
      See Also:
    • 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:
    • fromToken

      public static OPERATOR fromToken(String token)
    • 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: