Class CheckerPeriod
- All Implemented Interfaces:
InterfaceChecker<AbstractChecker<Period,
CheckerPeriod>, Period>
CheckerPeriod is a specialized checker for validating and performing assertions on
Period
values.
It provides a fluent API for common period validations such as checking positivity, negativity, zero, and comparisons with other periods or temporal units.
-
Field Summary
Fields inherited from class util.AbstractChecker
backObject, exceptionTracker, name, object, saveErrors, stop
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
CheckerPeriod
(Period period, String name) Constructs a newCheckerPeriod
with the specified period and name. -
Method Summary
Modifier and TypeMethodDescriptionstatic CheckerPeriod
Creates a new CheckerPeriod instance for the given period with a default name.static CheckerPeriod
Creates a new CheckerPeriod instance for the given period and name.Checks if the period is equal to another period.isEqual
(TemporalUnit temporalUnit, double time) Checks if the period is equal to the specified time in the given temporal unit.isGreaterOrEqualThan
(Period other) Checks if the period is greater than or equal to another period.isGreaterOrEqualThan
(TemporalUnit temporalUnit, double time) Checks if the period is greater than or equal to the specified time in the given temporal unit.isGreaterThan
(Period other) Checks if the period is greater than another period.isGreaterThan
(TemporalUnit temporalUnit, double time) Checks if the period is greater than the specified time in the given temporal unit.isLessOrEqualThan
(Period other) Checks if the period is less than or equal to another period.isLessOrEqualThan
(TemporalUnit temporalUnit, double time) Checks if the period is less than or equal to the specified time in the given temporal unit.isLessThan
(Period other) Checks if the period is less than another period.isLessThan
(TemporalUnit temporalUnit, double time) Checks if the period is less than the specified time in the given temporal unit.Checks if the period is negative (less than zero).Checks if the period is positive (greater than zero).isZero()
Checks if the period is zero.protected CheckerPeriod
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
-
CheckerPeriod
-
-
Method Details
-
check
Creates a new CheckerPeriod instance for the given period and name.- Parameters:
period
- the period value to be checkedname
- the name to identify the period in error messages- Returns:
- a CheckerPeriod instance for further validations
-
check
Creates a new CheckerPeriod instance for the given period with a default name.- Parameters:
period
- the period value to be checked- Returns:
- a CheckerPeriod instance for further validations
-
self
Returns this instance (for fluent API usage).- Specified by:
self
in classAbstractChecker<Period,
CheckerPeriod> - Returns:
- this CheckerPeriod instance
-
isPositive
Checks if the period is positive (greater than zero).- Returns:
- this CheckerPeriod instance for chaining
-
isNegative
Checks if the period is negative (less than zero).- Returns:
- this CheckerPeriod instance for chaining
-
isZero
Checks if the period is zero.- Returns:
- this CheckerPeriod instance for chaining
-
isGreaterThan
Checks if the period is greater than the specified time in the given temporal unit.- Parameters:
temporalUnit
- the unit of time to compare (e.g., YEARS, MONTHS, DAYS)time
- the value to compare against- Returns:
- this CheckerPeriod instance for chaining
-
isGreaterOrEqualThan
Checks if the period is greater than or equal to the specified time in the given temporal unit.- Parameters:
temporalUnit
- the unit of time to compare (e.g., YEARS, MONTHS, DAYS)time
- the value to compare against- Returns:
- this CheckerPeriod instance for chaining
-
isLessThan
Checks if the period is less than the specified time in the given temporal unit.- Parameters:
temporalUnit
- the unit of time to compare (e.g., YEARS, MONTHS, DAYS)time
- the value to compare against- Returns:
- this CheckerPeriod instance for chaining
-
isLessOrEqualThan
Checks if the period is less than or equal to the specified time in the given temporal unit.- Parameters:
temporalUnit
- the unit of time to compare (e.g., YEARS, MONTHS, DAYS)time
- the value to compare against- Returns:
- this CheckerPeriod instance for chaining
-
isEqual
Checks if the period is equal to the specified time in the given temporal unit.- Parameters:
temporalUnit
- the unit of time to compare (e.g., YEARS, MONTHS, DAYS)time
- the value to compare against- Returns:
- this CheckerPeriod instance for chaining
-
isGreaterThan
Checks if the period is greater than another period.- Parameters:
other
- the other period to compare with- Returns:
- this CheckerPeriod instance for chaining
-
isGreaterOrEqualThan
Checks if the period is greater than or equal to another period.- Parameters:
other
- the other period to compare with- Returns:
- this CheckerPeriod instance for chaining
-
isLessThan
Checks if the period is less than another period.- Parameters:
other
- the other period to compare with- Returns:
- this CheckerPeriod instance for chaining
-
isLessOrEqualThan
Checks if the period is less than or equal to another period.- Parameters:
other
- the other period to compare with- Returns:
- this CheckerPeriod instance for chaining
-
isEqual
Checks if the period is equal to another period.- Parameters:
other
- the other period to compare with- Returns:
- this CheckerPeriod instance for chaining
-