Class CheckerInteger

java.lang.Object
util.AbstractChecker<Integer,CheckerInteger>
specialized_checkers.math.numbers.integerTypes.CheckerInteger
All Implemented Interfaces:
InterfaceCheckerNumber<CheckerInteger>, InterfaceChecker<AbstractChecker<Integer,CheckerInteger>,Integer>

public class CheckerInteger extends AbstractChecker<Integer,CheckerInteger> implements InterfaceCheckerNumber<CheckerInteger>
Checker for Integer instances, providing fluent validation methods for integer numbers.

This class allows you to validate and assert properties of Integer objects in a fluent and readable way.

  • Constructor Details

    • CheckerInteger

      protected CheckerInteger(Integer nInteger, String name)
      Constructs a new CheckerInteger with the specified nInteger and name.
      Parameters:
      nInteger - the Integer to be wrapped and checked
      name - the name identifying this checker function
  • Method Details

    • check

      public static CheckerInteger check(Integer number, String name)
      Creates a new CheckerInteger for the given Integer instance with a custom name.
      Parameters:
      number - the Integer instance to be checked
      name - the name to identify this checker instance (useful for error messages)
      Returns:
      a new CheckerInteger for the provided Integer
    • check

      public static CheckerInteger check(Number number, String name)
      Creates a new CheckerInteger for the given Number instance with a custom name.
      Parameters:
      number - the Number instance to be checked (converted to int)
      name - the name to identify this checker instance (useful for error messages)
      Returns:
      a new CheckerInteger for the provided Number
    • check

      public static CheckerInteger check(Integer number)
      Creates a new CheckerInteger for the given Integer instance with a default name.
      Parameters:
      number - the Integer instance to be checked
      Returns:
      a new CheckerInteger for the provided Integer
    • check

      public static CheckerInteger check(Number number)
      Creates a new CheckerInteger for the given Number instance with a default name.
      Parameters:
      number - the Number instance to be checked (converted to int)
      Returns:
      a new CheckerInteger for the provided Number
    • self

      protected CheckerInteger self()
      Returns this checker instance (for fluent API usage).
      Specified by:
      self in class AbstractChecker<Integer,CheckerInteger>
      Returns:
      this CheckerInteger instance
    • isEven

      public CheckerInteger isEven()
      Asserts that the Integer value is even (divisible by two).
      Returns:
      this CheckerInteger instance for further validation
    • isOdd

      public CheckerInteger isOdd()
      Asserts that the Integer value is odd (not divisible by two).
      Returns:
      this CheckerInteger instance for further validation
    • isPrime

      public CheckerInteger isPrime()
      Asserts that the Integer value is prime.
      Returns:
      this CheckerInteger instance for further validation
    • isPositive

      public CheckerInteger isPositive()
      Asserts that the Integer value is positive (greater than zero).
      Specified by:
      isPositive in interface InterfaceCheckerNumber<CheckerInteger>
      Returns:
      this CheckerInteger instance for further validation
    • isPositiveOrZero

      public CheckerInteger isPositiveOrZero()
      Asserts that the Integer value is positive or zero (greater than or equal to zero).
      Specified by:
      isPositiveOrZero in interface InterfaceCheckerNumber<CheckerInteger>
      Returns:
      this CheckerInteger instance for further validation
    • isNegative

      public CheckerInteger isNegative()
      Asserts that the Integer value is negative (less than zero).
      Specified by:
      isNegative in interface InterfaceCheckerNumber<CheckerInteger>
      Returns:
      this CheckerInteger instance for further validation
    • isNegativeOrZero

      public CheckerInteger isNegativeOrZero()
      Asserts that the Integer value is negative or zero (less than or equal to zero).
      Specified by:
      isNegativeOrZero in interface InterfaceCheckerNumber<CheckerInteger>
      Returns:
      this CheckerInteger instance for further validation
    • isZero

      public CheckerInteger isZero()
      Asserts that the Integer value is zero.
      Specified by:
      isZero in interface InterfaceCheckerNumber<CheckerInteger>
      Returns:
      this CheckerInteger instance for further validation
    • isGreaterThan

      public CheckerInteger isGreaterThan(Byte number)
      Asserts that the Integer value is greater than the specified value.
      Specified by:
      isGreaterThan in interface InterfaceCheckerNumber<CheckerInteger>
      Parameters:
      number - the value to compare against
      Returns:
      this CheckerInteger instance for further validation
    • isGreaterThan

      public CheckerInteger isGreaterThan(Short number)
      Asserts that the Integer value is greater than or equal to the specified value.
      Specified by:
      isGreaterThan in interface InterfaceCheckerNumber<CheckerInteger>
      Parameters:
      number - the value to compare against
      Returns:
      this CheckerInteger instance for further validation
    • isGreaterThan

      public CheckerInteger isGreaterThan(Integer number)
      Asserts that the Integer value is less than the specified value.
      Specified by:
      isGreaterThan in interface InterfaceCheckerNumber<CheckerInteger>
      Parameters:
      number - the value to compare against
      Returns:
      this CheckerInteger instance for further validation
    • isGreaterThan

      public CheckerInteger isGreaterThan(Long number)
      Asserts that the Integer value is less than or equal to the specified value.
      Specified by:
      isGreaterThan in interface InterfaceCheckerNumber<CheckerInteger>
      Parameters:
      number - the value to compare against
      Returns:
      this CheckerInteger instance for further validation
    • isGreaterThan

      public CheckerInteger isGreaterThan(Float number)
      Asserts that the Integer value is greater than the specified Float value.
      Specified by:
      isGreaterThan in interface InterfaceCheckerNumber<CheckerInteger>
      Parameters:
      number - the Float value to compare against
      Returns:
      this CheckerInteger instance for further validation
    • isGreaterThan

      public CheckerInteger isGreaterThan(Double number)
      Asserts that the Integer value is greater than the specified Double value.
      Specified by:
      isGreaterThan in interface InterfaceCheckerNumber<CheckerInteger>
      Parameters:
      number - the Double value to compare against
      Returns:
      this CheckerInteger instance for further validation
    • isGreaterOrEqualTo

      public CheckerInteger isGreaterOrEqualTo(Byte number)
      Asserts that the Integer value is greater than or equal to the specified Byte value.
      Specified by:
      isGreaterOrEqualTo in interface InterfaceCheckerNumber<CheckerInteger>
      Parameters:
      number - the Byte value to compare against
      Returns:
      this CheckerInteger instance for further validation
    • isGreaterOrEqualTo

      public CheckerInteger isGreaterOrEqualTo(Short number)
      Asserts that the Integer value is greater than or equal to the specified Short value.
      Specified by:
      isGreaterOrEqualTo in interface InterfaceCheckerNumber<CheckerInteger>
      Parameters:
      number - the Short value to compare against
      Returns:
      this CheckerInteger instance for further validation
    • isGreaterOrEqualTo

      public CheckerInteger isGreaterOrEqualTo(Integer number)
      Asserts that the Integer value is greater than or equal to the specified Integer value.
      Specified by:
      isGreaterOrEqualTo in interface InterfaceCheckerNumber<CheckerInteger>
      Parameters:
      number - the Integer value to compare against
      Returns:
      this CheckerInteger instance for further validation
    • isGreaterOrEqualTo

      public CheckerInteger isGreaterOrEqualTo(Long number)
      Asserts that the Integer value is greater than or equal to the specified Long value.
      Specified by:
      isGreaterOrEqualTo in interface InterfaceCheckerNumber<CheckerInteger>
      Parameters:
      number - the Long value to compare against
      Returns:
      this CheckerInteger instance for further validation
    • isGreaterOrEqualTo

      public CheckerInteger isGreaterOrEqualTo(Float number)
      Asserts that the Integer value is greater than or equal to the specified Float value.
      Specified by:
      isGreaterOrEqualTo in interface InterfaceCheckerNumber<CheckerInteger>
      Parameters:
      number - the Float value to compare against
      Returns:
      this CheckerInteger instance for further validation
    • isGreaterOrEqualTo

      public CheckerInteger isGreaterOrEqualTo(Double number)
      Asserts that the Integer value is greater than or equal to the specified Double value.
      Specified by:
      isGreaterOrEqualTo in interface InterfaceCheckerNumber<CheckerInteger>
      Parameters:
      number - the Double value to compare against
      Returns:
      this CheckerInteger instance for further validation
    • isLessThan

      public CheckerInteger isLessThan(Byte number)
      Asserts that the Integer value is less than or equal to the specified Byte value.
      Specified by:
      isLessThan in interface InterfaceCheckerNumber<CheckerInteger>
      Parameters:
      number - the Byte value to compare against
      Returns:
      this CheckerInteger instance for further validation
    • isLessThan

      public CheckerInteger isLessThan(Short number)
      Asserts that the Integer value is less than or equal to the specified Short value.
      Specified by:
      isLessThan in interface InterfaceCheckerNumber<CheckerInteger>
      Parameters:
      number - the Short value to compare against
      Returns:
      this CheckerInteger instance for further validation
    • isLessThan

      public CheckerInteger isLessThan(Integer number)
      Asserts that the Integer value is less than or equal to the specified Integer value.
      Specified by:
      isLessThan in interface InterfaceCheckerNumber<CheckerInteger>
      Parameters:
      number - the Integer value to compare against
      Returns:
      this CheckerInteger instance for further validation
    • isLessThan

      public CheckerInteger isLessThan(Long number)
      Asserts that the Integer value is less than or equal to the specified Long value.
      Specified by:
      isLessThan in interface InterfaceCheckerNumber<CheckerInteger>
      Parameters:
      number - the Long value to compare against
      Returns:
      this CheckerInteger instance for further validation
    • isLessThan

      public CheckerInteger isLessThan(Float number)
      Asserts that the Integer value is less than the specified Float value.
      Specified by:
      isLessThan in interface InterfaceCheckerNumber<CheckerInteger>
      Parameters:
      number - the Float value to compare against
      Returns:
      this CheckerInteger instance for further validation
    • isLessThan

      public CheckerInteger isLessThan(Double number)
      Asserts that the Integer value is less than the specified Double value.
      Specified by:
      isLessThan in interface InterfaceCheckerNumber<CheckerInteger>
      Parameters:
      number - the Double value to compare against
      Returns:
      this CheckerInteger instance for further validation
    • isLessOrEqualTo

      public CheckerInteger isLessOrEqualTo(Byte number)
      Asserts that the Integer value is less than or equal to the specified Byte value.
      Specified by:
      isLessOrEqualTo in interface InterfaceCheckerNumber<CheckerInteger>
      Parameters:
      number - the Byte value to compare against
      Returns:
      this CheckerInteger instance for further validation
    • isLessOrEqualTo

      public CheckerInteger isLessOrEqualTo(Short number)
      Asserts that the Integer value is less than or equal to the specified Short value.
      Specified by:
      isLessOrEqualTo in interface InterfaceCheckerNumber<CheckerInteger>
      Parameters:
      number - the Short value to compare against
      Returns:
      this CheckerInteger instance for further validation
    • isLessOrEqualTo

      public CheckerInteger isLessOrEqualTo(Integer number)
      Asserts that the Integer value is less than or equal to the specified Integer value.
      Specified by:
      isLessOrEqualTo in interface InterfaceCheckerNumber<CheckerInteger>
      Parameters:
      number - the Integer value to compare against
      Returns:
      this CheckerInteger instance for further validation
    • isLessOrEqualTo

      public CheckerInteger isLessOrEqualTo(Long number)
      Asserts that the Integer value is less than or equal to the specified Long value.
      Specified by:
      isLessOrEqualTo in interface InterfaceCheckerNumber<CheckerInteger>
      Parameters:
      number - the Long value to compare against
      Returns:
      this CheckerInteger instance for further validation
    • isLessOrEqualTo

      public CheckerInteger isLessOrEqualTo(Float number)
      Asserts that the Integer value is less than or equal to the specified Float value.
      Specified by:
      isLessOrEqualTo in interface InterfaceCheckerNumber<CheckerInteger>
      Parameters:
      number - the Float value to compare against
      Returns:
      this CheckerInteger instance for further validation
    • isLessOrEqualTo

      public CheckerInteger isLessOrEqualTo(Double number)
      Asserts that the Integer value is less than or equal to the specified Double value.
      Specified by:
      isLessOrEqualTo in interface InterfaceCheckerNumber<CheckerInteger>
      Parameters:
      number - the Double value to compare against
      Returns:
      this CheckerInteger instance for further validation