Type Parameters:
S - the type of validator
All Known Subinterfaces:
PrimitiveIntegerValidator, PrimitiveUnsignedIntegerValidator

public interface IntegerComponent<S>
Validates the state of an Integer or int.
  • Method Summary

    Modifier and Type
    Method
    Description
    isBetween(int minimum, boolean minimumIsInclusive, int maximum, boolean maximumIsInclusive)
    Ensures that the value is within a range.
    isBetween(int minimumInclusive, int maximumExclusive)
    Ensures that the value is within a range.
    isGreaterThan(int minimumExclusive)
    Ensures that the value is greater than a lower bound.
    isGreaterThan(int minimumExclusive, String name)
    Ensures that the value is greater than a lower bound.
    isGreaterThanOrEqualTo(int minimumInclusive)
    Ensures that the value is greater than or equal to a minimum value.
    isGreaterThanOrEqualTo(int minimumInclusive, String name)
    Ensures that the value is greater than or equal a minimum value.
    isLessThan(int maximumExclusive)
    Ensures that the value is less than an upper bound.
    isLessThan(int maximumExclusive, String name)
    Ensures that the value is less than an upper bound.
    isLessThanOrEqualTo(int maximumInclusive)
    Ensures that the value is less than or equal to a maximum value.
    isLessThanOrEqualTo(int maximumInclusive, String name)
    Ensures that the value is less than or equal to a maximum value.
    isMultipleOf(int factor)
    Ensures that the value is a multiple of factor.
    isMultipleOf(int factor, String name)
    Ensures that the value is a multiple of factor.
    isNotMultipleOf(int factor)
    Ensures that the value is not a multiple of factor.
    isNotMultipleOf(int factor, String name)
    Ensures that the value is not a multiple of factor.
  • Method Details

    • isMultipleOf

      S isMultipleOf(int factor)
      Ensures that the value is a multiple of factor.
      Parameters:
      factor - the number being multiplied
      Returns:
      this
      Throws:
      NullPointerException - if the value is null
      IllegalArgumentException - if the value is not a multiple of factor
    • isMultipleOf

      S isMultipleOf(int factor, String name)
      Ensures that the value is a multiple of factor.
      Parameters:
      factor - the number being multiplied
      name - the name of the factor
      Returns:
      this
      Throws:
      NullPointerException - if the value or name are null
      IllegalArgumentException - if:
      • name is empty
      • name contains whitespace
      • name is already in use by the value being validated or the validator context
      • the value is not a multiple of factor
    • isNotMultipleOf

      S isNotMultipleOf(int factor)
      Ensures that the value is not a multiple of factor.
      Parameters:
      factor - the number being multiplied
      Returns:
      this
      Throws:
      NullPointerException - if the value is null
      IllegalArgumentException - if the value is a multiple of factor
    • isNotMultipleOf

      S isNotMultipleOf(int factor, String name)
      Ensures that the value is not a multiple of factor.
      Parameters:
      factor - the number being multiplied
      name - the name of the factor
      Returns:
      this
      Throws:
      NullPointerException - if the value or name are null
      IllegalArgumentException - if:
      • name is empty
      • name contains whitespace
      • name is already in use by the value being validated or the validator context
      • the value is a multiple of factor
    • isLessThan

      S isLessThan(int maximumExclusive)
      Ensures that the value is less than an upper bound.
      Parameters:
      maximumExclusive - the exclusive upper bound
      Returns:
      this
      Throws:
      NullPointerException - if the value is null
      IllegalArgumentException - if the value is greater than or equal to maximumExclusive
    • isLessThan

      S isLessThan(int maximumExclusive, String name)
      Ensures that the value is less than an upper bound.
      Parameters:
      maximumExclusive - the exclusive upper bound
      name - the name of the upper bound
      Returns:
      this
      Throws:
      NullPointerException - if the value or name are null
      IllegalArgumentException - if:
      • name is empty
      • name contains whitespace
      • name is already in use by the value being validated or the validator context
      • the value is greater than or equal to maximumExclusive
    • isLessThanOrEqualTo

      S isLessThanOrEqualTo(int maximumInclusive)
      Ensures that the value is less than or equal to a maximum value.
      Parameters:
      maximumInclusive - the inclusive upper value
      Returns:
      this
      Throws:
      NullPointerException - if the value is null
      IllegalArgumentException - if the value is greater than maximumInclusive
    • isLessThanOrEqualTo

      S isLessThanOrEqualTo(int maximumInclusive, String name)
      Ensures that the value is less than or equal to a maximum value.
      Parameters:
      maximumInclusive - the maximum value
      name - the name of the maximum value
      Returns:
      this
      Throws:
      NullPointerException - if the value or name are null
      IllegalArgumentException - if:
      • name is empty
      • name contains whitespace
      • name is already in use by the value being validated or the validator context
      • the value is greater than maximumInclusive
    • isGreaterThanOrEqualTo

      S isGreaterThanOrEqualTo(int minimumInclusive)
      Ensures that the value is greater than or equal to a minimum value.
      Parameters:
      minimumInclusive - the minimum value
      Returns:
      this
      Throws:
      NullPointerException - if the value is null
      IllegalArgumentException - if the value is less than minimumInclusive
    • isGreaterThanOrEqualTo

      S isGreaterThanOrEqualTo(int minimumInclusive, String name)
      Ensures that the value is greater than or equal a minimum value.
      Parameters:
      minimumInclusive - the minimum value
      name - the name of the minimum value
      Returns:
      this
      Throws:
      NullPointerException - if the value or name are null
      IllegalArgumentException - if:
      • name is empty
      • name contains whitespace
      • name is already in use by the value being validated or the validator context
      • the value is less than minimumInclusive
    • isGreaterThan

      S isGreaterThan(int minimumExclusive)
      Ensures that the value is greater than a lower bound.
      Parameters:
      minimumExclusive - the exclusive lower bound
      Returns:
      this
      Throws:
      NullPointerException - if the value is null
      IllegalArgumentException - if the value is less than or equal to minimumExclusive
    • isGreaterThan

      S isGreaterThan(int minimumExclusive, String name)
      Ensures that the value is greater than a lower bound.
      Parameters:
      minimumExclusive - the exclusive lower bound
      name - the name of the lower bound
      Returns:
      this
      Throws:
      NullPointerException - if the value or name are null
      IllegalArgumentException - if:
      • name is empty
      • name contains whitespace
      • name is already in use by the value being validated or the validator context
      • the value is less or equal to minimumExclusive
    • isBetween

      S isBetween(int minimumInclusive, int maximumExclusive)
      Ensures that the value is within a range.
      Parameters:
      minimumInclusive - the lower bound of the range (inclusive)
      maximumExclusive - the upper bound of the range (exclusive)
      Returns:
      this
      Throws:
      NullPointerException - if the value is null
      IllegalArgumentException - if:
      • minimumInclusive is greater than maximumExclusive
      • the value is greater than or equal to maximumExclusive
    • isBetween

      S isBetween(int minimum, boolean minimumIsInclusive, int maximum, boolean maximumIsInclusive)
      Ensures that the value is within a range.
      Parameters:
      minimum - the lower bound of the range
      minimumIsInclusive - true if the lower bound of the range is inclusive
      maximum - the upper bound of the range
      maximumIsInclusive - true if the upper bound of the range is inclusive
      Returns:
      this
      Throws:
      NullPointerException - if the value is null
      IllegalArgumentException - if:
      • minimum is greater than maximum
      • minimumIsInclusive is true and the value is less than minimum
      • minimumIsInclusive is false and the value is less than or equal to minimum
      • maximumIsInclusive is true and the value is greater than maximum
      • maximumIsInclusive is false and the value is greater than or equal to maximum