Class 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.
-
Field Summary
Fields inherited from class util.AbstractChecker
backObject, exceptionTracker, name, object, saveErrors, stop
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
CheckerDate
(Date date, String name) Constructs a newCheckerDate
with the specified date and name. -
Method Summary
Modifier and TypeMethodDescriptionstatic CheckerDate
Creates a new CheckerDate instance for the given date with a default name.static CheckerDate
Creates a new CheckerDate instance for the given date and name.Checks if the date is within the specified range (exclusive).Checks if the date is after the specified date.isAfterOrEqual
(Date date) Checks if the date is after or equal to the specified date.Checks if the date is before the specified date.isBeforeOrEqual
(Date date) Checks if the date is before or equal to the specified date.isFuture()
Checks if the date is in the future (after the current date and time).isPast()
Checks if the date is in the past (before the current date and time).protected CheckerDate
self()
Returns this instance (for fluent API usage).Methods inherited from class util.AbstractChecker
checkProperty, checkProperty, checkProperty, end, getMethod, getObject, getProperty, hasErrors, hasNotErrors, is, is, isEqual, isNonNull, isNot, isNot, isNull, notSaveErrors, saveErrors, show, showNotThrownException, showThrownException, stop
-
Constructor Details
-
CheckerDate
-
-
Method Details
-
check
Creates a new CheckerDate instance for the given date and name.- Parameters:
date
- the date value to be checkedname
- the name to identify the date in error messages- Returns:
- a CheckerDate instance for further validations
-
check
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
Returns this instance (for fluent API usage).- Specified by:
self
in classAbstractChecker<Date,
CheckerDate> - Returns:
- this CheckerDate instance
-
isBefore
Checks if the date is before the specified date.- Specified by:
isBefore
in interfaceInterfaceCheckerDate<CheckerDate,
Date> - Parameters:
date
- the date to compare with- Returns:
- this CheckerDate instance for chaining
-
isBeforeOrEqual
Checks if the date is before or equal to the specified date.- Specified by:
isBeforeOrEqual
in interfaceInterfaceCheckerDate<CheckerDate,
Date> - Parameters:
date
- the date to compare with- Returns:
- this CheckerDate instance for chaining
-
isAfter
Checks if the date is after the specified date.- Specified by:
isAfter
in interfaceInterfaceCheckerDate<CheckerDate,
Date> - Parameters:
date
- the date to compare with- Returns:
- this CheckerDate instance for chaining
-
isAfterOrEqual
Checks if the date is after or equal to the specified date.- Specified by:
isAfterOrEqual
in interfaceInterfaceCheckerDate<CheckerDate,
Date> - Parameters:
date
- the date to compare with- Returns:
- this CheckerDate instance for chaining
-
inRange
Checks if the date is within the specified range (exclusive).- Specified by:
inRange
in interfaceInterfaceCheckerDate<CheckerDate,
Date> - Parameters:
date_1
- the start date (exclusive)date_2
- the end date (exclusive)- Returns:
- this CheckerDate instance for chaining
-
isPast
Checks if the date is in the past (before the current date and time).- Specified by:
isPast
in interfaceInterfaceCheckerDate<CheckerDate,
Date> - Returns:
- this CheckerDate instance for chaining
-
isFuture
Checks if the date is in the future (after the current date and time).- Specified by:
isFuture
in interfaceInterfaceCheckerDate<CheckerDate,
Date> - Returns:
- this CheckerDate instance for chaining
-