Enum Class OperatorType

java.lang.Object
java.lang.Enum<OperatorType>
com.jbstrap.core.dao.enums.OperatorType
All Implemented Interfaces:
Serializable, Comparable<OperatorType>, Constable

public enum OperatorType extends Enum<OperatorType>

Operator types

The operator types can be used with the Criteria object, and they can be used to describe certain criteria. These can be used as filters when filtering data, or to test a Record.

Since:
4.0
Author:
JBStrap
  • Enum Constant Details

    • AND

      public static final OperatorType AND
      An 'AND' connection between two or more criteria. Can only be used with a complex criteria
    • OR

      public static final OperatorType OR
      An 'OR' connection between two or more criteria. Can only be used with a complex criteria
    • IN_SET

      public static final OperatorType IN_SET

      This operator checks if a value is in the specified list. The values need to be specified in the List format. The list has to have the same type, as the examined value.

      The criterion is met if the value is on the list

    • NOT_IN_SET

      public static final OperatorType NOT_IN_SET

      This operator checks if a value isn't in the specified list. The values need to be specified in the List format. The list has to have the same type, as the examined value.

      The criterion is met if the value is not on the list

    • IS_NULL

      public static final OperatorType IS_NULL
      Checks for null value. No value needs to be specified. The criteria is met, if the value is null
    • NOT_NULL

      public static final OperatorType NOT_NULL
      Checks if the value is not null. No value needs to be specified. The criteria is met, if the value is not null
    • EQUALS

      public static final OperatorType EQUALS

      Checks for equality. The operator can be given any value, which will be checked against the examined value(In case of a JPA based database  query,the given value doesn't need to have the same type as the column, any class is accepted that can interpret automatic conversion)

      The criteria is met if both values are equal

    • NOT_EQUALS

      public static final OperatorType NOT_EQUALS

      Examines if the two values are not equal. The operator can be given any value, which will be checked against the examined value(In case of a JPA based database  query,the given value doesn't need to have the same type as the column, any class is accepted that can interpret automatic conversion)

      The criteria is met if the values are not equal

    • LIKE

      public static final OperatorType LIKE

      The operator checks if the examined text contains the specified text. This operator only works with a string value

      The criteria will be met if the examined value is a string, and contains the specified value

    • STARTS_WITH

      public static final OperatorType STARTS_WITH

      The operator checks if the examined text starts with the specified text. This operator only works with a string value

      The criteria will be met if the examined value is a string, and starts with the specified value

    • ENDS_WITH

      public static final OperatorType ENDS_WITH

      The operator checks if the examined text ends with the specified text. This operator only works with a string value

      The criteria will be met if the examined value is a string, and ends with the specified value

    • NOT_LIKE

      public static final OperatorType NOT_LIKE

      The operator checks if the examined text doesn't contain the specified text. This operator only works with a string value

      The criteria will be met if the examined value is a string, and doesn't contain the specified value

    • NOT_STARTS_WITH

      public static final OperatorType NOT_STARTS_WITH

      The operator checks if the examined text doesn't start with the specified text. This operator only works with a string value

      The criteria will be met if the examined value is a string, and doesn't start with the specified value

    • NOT_ENDS_WITH

      public static final OperatorType NOT_ENDS_WITH

      The operator checks if the examined text doesn't end with the specified text. This operator only works with a string value

      The criteria will be met if the examined value is a string, and doesn't end with the specified value

    • GREATER_THAN

      public static final OperatorType GREATER_THAN

      The operator checks if the examined value is greater than the specified value. This operator only works with Number or Date values

      The criteria will be met if the examined value is greater (or if it's a date, a later date) than the specified value

    • GREATER_OR_EQUAL

      public static final OperatorType GREATER_OR_EQUAL

      The operator checks if the examined value is greater or equal than the specified value. This operator only works with Number or Date values

      The criteria will be met if the examined value is greater (or if it's a date, a later date) or equal than the specified value

    • LESS_THAN

      public static final OperatorType LESS_THAN

      The operator checks if the examined value is less than the specified value. This operator only works with Number or Date values

      The criteria will be met if the examined value is less (or if it's a date, an earlier date)than the specified value

    • LESS_OR_EQUAL

      public static final OperatorType LESS_OR_EQUAL

      The operator checks if the examined value is less or equal than the specified value. This operator only works with Number or Date values

      The criteria will be met if the examined value is less (or if it's a date, an earlier date) or equal than the specified value

  • Method Details

    • values

      public static OperatorType[] 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 OperatorType 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
    • getType

      public OperatorTypeBreed getType()
      Returns:
      The operator type
      See Also:
    • getRequiredValueClass

      public Class<?> getRequiredValueClass()
      Returns:
      The required value class
    • getCriteriaBuilderMethodName

      public String getCriteriaBuilderMethodName()
      Returns:
      The name of the CriteriaBuilder method, that the operator uses
      See Also:
      • CriteriaBuilder
    • getParamTypes

      public Class<?>[] getParamTypes()
      Returns:
      The type of the parameters, from the CriteriaBuilder method, that the operator uses
      See Also:
      • CriteriaBuilder
    • getPrefix

      public String getPrefix()
      Returns:
      The prefix text
    • getPostfix

      public String getPostfix()
      Returns:
      The postfix text
    • isNegated

      public boolean isNegated()
      Returns:
      true if negated, otherwise false
    • fromName

      public static OperatorType fromName(String name)
      Determines the operator type, by specifying its name. Not case-sensitive
      Parameters:
      name - The operator name as a string
      Returns:
      The specified operator or null, if not found
    • getPredicate

      public BiPredicate<Object,Object> getPredicate()
      Returns:
      The predicate or null, if not found
    • test

      public boolean test(Object data, Object value)
      Parameters:
      data - The data value that will be examined
      value - The operator value, that will be used for comparison
      Returns:
      true, if they pass the test, otherwise false