Class NumberValidationRules

java.lang.Object
org.strassburger.tui4j.input.validationrules.NumberValidationRules

public class NumberValidationRules extends Object
  • Constructor Details

    • NumberValidationRules

      public NumberValidationRules()
  • Method Details

    • lessThan

      public static <T extends Number & Comparable<T>> ValidationRule<T> lessThan(T value)
      Validates that the input is equal to the given value.
      Type Parameters:
      T - The type of the input.
      Parameters:
      value - The value to compare the input to.
      Returns:
      A ValidationRule that validates that the input is equal to the given value.
    • lessThan

      public static <T extends Number & Comparable<T>> ValidationRule<T> lessThan(T value, String errorMessage)
      Validates that the input is equal to the given value with a custom error message.
      Type Parameters:
      T - The type of the input.
      Parameters:
      value - The value to compare the input to.
      errorMessage - The custom error message.
      Returns:
      A ValidationRule that validates that the input is equal to the given value.
    • lessThan

      public static <T extends Number & Comparable<T>> ValidationRule<T> lessThan(T value, StyledText errorMessage)
      Validates that the input is equal to the given value with a custom error message.
      Type Parameters:
      T - The type of the input.
      Parameters:
      value - The value to compare the input to.
      errorMessage - The custom error message.
      Returns:
      A ValidationRule that validates that the input is equal to the given value.
    • greaterThan

      public static <T extends Number & Comparable<T>> ValidationRule<T> greaterThan(T value)
      Validates that the input is greater than the given value.
      Type Parameters:
      T - The type of the input.
      Parameters:
      value - The value to compare the input to.
      Returns:
      A ValidationRule that validates that the input is greater than the given value.
    • greaterThan

      public static <T extends Number & Comparable<T>> ValidationRule<T> greaterThan(T value, String errorMessage)
      Validates that the input is greater than the given value with a custom error message.
      Type Parameters:
      T - The type of the input.
      Parameters:
      value - The value to compare the input to.
      errorMessage - The custom error message.
      Returns:
      A ValidationRule that validates that the input is greater than the given value.
    • greaterThan

      public static <T extends Number & Comparable<T>> ValidationRule<T> greaterThan(T value, StyledText errorMessage)
      Validates that the input is greater than the given value with a custom error message.
      Type Parameters:
      T - The type of the input.
      Parameters:
      value - The value to compare the input to.
      errorMessage - The custom error message.
      Returns:
      A ValidationRule that validates that the input is greater than the given value.
    • lessThanOrEqualTo

      public static <T extends Number & Comparable<T>> ValidationRule<T> lessThanOrEqualTo(T value)
      Validates that the input is less than or equal to the given value.
      Type Parameters:
      T - The type of the input.
      Parameters:
      value - The value to compare the input to.
      Returns:
      A ValidationRule that validates that the input is less than or equal to the given value.
    • lessThanOrEqualTo

      public static <T extends Number & Comparable<T>> ValidationRule<T> lessThanOrEqualTo(T value, String errorMessage)
      Validates that the input is less than or equal to the given value with a custom error message.
      Type Parameters:
      T - The type of the input.
      Parameters:
      value - The value to compare the input to.
      errorMessage - The custom error message.
      Returns:
      A ValidationRule that validates that the input is less than or equal to the given value.
    • lessThanOrEqualTo

      public static <T extends Number & Comparable<T>> ValidationRule<T> lessThanOrEqualTo(T value, StyledText errorMessage)
      Validates that the input is less than or equal to the given value with a custom error message.
      Type Parameters:
      T - The type of the input.
      Parameters:
      value - The value to compare the input to.
      errorMessage - The custom error message.
      Returns:
      A ValidationRule that validates that the input is less than or equal to the given value.
    • greaterThanOrEqualTo

      public static <T extends Number & Comparable<T>> ValidationRule<T> greaterThanOrEqualTo(T value)
      Validates that the input is greater than or equal to the given value.
      Type Parameters:
      T - The type of the input.
      Parameters:
      value - The value to compare the input to.
      Returns:
      A ValidationRule that validates that the input is greater than or equal to the given value.
    • greaterThanOrEqualTo

      public static <T extends Number & Comparable<T>> ValidationRule<T> greaterThanOrEqualTo(T value, String errorMessage)
      Validates that the input is greater than or equal to the given value with a custom error message.
      Type Parameters:
      T - The type of the input.
      Parameters:
      value - The value to compare the input to.
      errorMessage - The custom error message.
      Returns:
      A ValidationRule that validates that the input is greater than or equal to the given value.
    • greaterThanOrEqualTo

      public static <T extends Number & Comparable<T>> ValidationRule<T> greaterThanOrEqualTo(T value, StyledText errorMessage)
      Validates that the input is greater than or equal to the given value with a custom error message.
      Type Parameters:
      T - The type of the input.
      Parameters:
      value - The value to compare the input to.
      errorMessage - The custom error message.
      Returns:
      A ValidationRule that validates that the input is greater than or equal to the given value.