Class CheckerDate
java.lang.Object
com.luchersol.core.util.AbstractChecker<Date,CheckerDate>
com.luchersol.core.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>
A specialized checker for
Date instances, providing fluent API methods
to assert temporal properties such as being before/after another date, inclusivity checks,
range validations, and whether a date lies in the past or future.
Typical usage:
Date deadline = ...;
Date now = new Date();
CheckerDate checker = CheckerDate.check(deadline)
.isAfter(now)
.inRange(now, new Date(now.getTime() + 86400000)) // within the next 24 hours
.isFuture();
This class integrates with InterfaceCheckerDate for standardized temporal
validations and supports chaining multiple assertions in a fluent, expressive style.
- See Also:
-
Field Summary
Fields inherited from class com.luchersol.core.util.AbstractChecker
backObject, exceptionTracker, name, object, saveErrors, stop -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedCheckerDate(Date date, String name) Constructs a newCheckerDatewith the specified date and name. -
Method Summary
Modifier and TypeMethodDescriptionstatic CheckerDateCreates a new CheckerDate instance for the given date with a default name.static CheckerDateCreates 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 CheckerDateself()Returns this instance (for fluent API usage).Methods inherited from class com.luchersol.core.util.AbstractChecker
checkProperty, checkProperty, checkProperty, checkProperty, end, getMethod, getObject, getProperty, hasErrors, hasNotErrors, is, is, is, isEqual, isNonNull, isNot, isNot, isNull, notSaveErrors, saveErrors, setBackObject, setExceptionTracker, setName, setObject, setSaveErrors, setStop, show, showPassedChecks, showThrownException, stop, toChecker, updateChecker
-
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:
selfin classAbstractChecker<Date,CheckerDate> - Returns:
- this CheckerDate instance
-
isBefore
Checks if the date is before the specified date.- Specified by:
isBeforein 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:
isBeforeOrEqualin 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:
isAfterin 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:
isAfterOrEqualin 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:
inRangein 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:
isPastin 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:
isFuturein interfaceInterfaceCheckerDate<CheckerDate,Date> - Returns:
- this CheckerDate instance for chaining
-