Class CheckerDate

java.lang.Object
util.AbstractChecker<Date,CheckerDate>
specialized_checkers.time.temporal.CheckerDate
All Implemented Interfaces:
InterfaceCheckerDate<CheckerDate,Date>, InterfaceChecker<AbstractChecker<Date,CheckerDate>,Date>

public class CheckerDate extends AbstractChecker<Date,CheckerDate> implements InterfaceCheckerDate<CheckerDate,Date>
CheckerDate is a specialized checker for validating and performing assertions on Date values.

It provides a fluent API for common date validations such as checking if a date is before, after, in range, past, or future.

  • Constructor Details

    • CheckerDate

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

    • check

      public static CheckerDate check(Date date, String name)
      Creates a new CheckerDate instance for the given date and name.
      Parameters:
      date - the date value to be checked
      name - the name to identify the date in error messages
      Returns:
      a CheckerDate instance for further validations
    • check

      public static CheckerDate check(Date date)
      Creates a new CheckerDate instance for the given date with a default name.
      Parameters:
      date - the date value to be checked
      Returns:
      a CheckerDate instance for further validations
    • self

      protected CheckerDate self()
      Returns this instance (for fluent API usage).
      Specified by:
      self in class AbstractChecker<Date,CheckerDate>
      Returns:
      this CheckerDate instance
    • isBefore

      public CheckerDate isBefore(Date date)
      Checks if the date is before the specified date.
      Specified by:
      isBefore in interface InterfaceCheckerDate<CheckerDate,Date>
      Parameters:
      date - the date to compare with
      Returns:
      this CheckerDate instance for chaining
    • isBeforeOrEqual

      public CheckerDate isBeforeOrEqual(Date date)
      Checks if the date is before or equal to the specified date.
      Specified by:
      isBeforeOrEqual in interface InterfaceCheckerDate<CheckerDate,Date>
      Parameters:
      date - the date to compare with
      Returns:
      this CheckerDate instance for chaining
    • isAfter

      public CheckerDate isAfter(Date date)
      Checks if the date is after the specified date.
      Specified by:
      isAfter in interface InterfaceCheckerDate<CheckerDate,Date>
      Parameters:
      date - the date to compare with
      Returns:
      this CheckerDate instance for chaining
    • isAfterOrEqual

      public CheckerDate isAfterOrEqual(Date date)
      Checks if the date is after or equal to the specified date.
      Specified by:
      isAfterOrEqual in interface InterfaceCheckerDate<CheckerDate,Date>
      Parameters:
      date - the date to compare with
      Returns:
      this CheckerDate instance for chaining
    • inRange

      public CheckerDate inRange(Date date_1, Date date_2)
      Checks if the date is within the specified range (exclusive).
      Specified by:
      inRange in interface InterfaceCheckerDate<CheckerDate,Date>
      Parameters:
      date_1 - the start date (exclusive)
      date_2 - the end date (exclusive)
      Returns:
      this CheckerDate instance for chaining
    • isPast

      public CheckerDate isPast()
      Checks if the date is in the past (before the current date and time).
      Specified by:
      isPast in interface InterfaceCheckerDate<CheckerDate,Date>
      Returns:
      this CheckerDate instance for chaining
    • isFuture

      public CheckerDate isFuture()
      Checks if the date is in the future (after the current date and time).
      Specified by:
      isFuture in interface InterfaceCheckerDate<CheckerDate,Date>
      Returns:
      this CheckerDate instance for chaining