Package jakarta.validation
Interface ClockProvider
-
public interface ClockProviderContract for obtaining theClockused as the reference fornowwhen validating the@Futureand@Pastconstraints.The default implementation will return the current system time. Plugging in custom implementations may be useful for instance in batch applications which need to run with a specific logical date, e.g. with yesterday's date when re-running a failed batch job execution.
Implementations must be safe for access from several threads at the same time.
- Since:
- 2.0
- Author:
- Gunnar Morling, Guillaume Smet
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description ClockgetClock()Returns the clock which serves as the reference fornow.
-
-
-
Method Detail
-
getClock
Clock getClock()
Returns the clock which serves as the reference fornow.- Returns:
- the clock which serves as the reference for
now; must not benull
-
-