Package no.digipost.time
Interface ClockAdjuster
- All Known Implementing Classes:
ControllableClock
public interface ClockAdjuster
A clock adjusting API, e.g. offered by a
ControllableClock.
This interface can for instance be used to easily expose time manipulation through another API,
but you do not want to expose a Clock or ControllableClock instance.-
Method Summary
Modifier and TypeMethodDescriptionvoidfreeze()Freeze the clock at its current instant in time.voidFreeze the clock at given instant.voidFreeze the clock at given instant andzone.voidfreezeAt(LocalDateTime offsetDateTime) Freeze the clock at given date and time.voidfreezeAt(OffsetDateTime offsetDateTime) Freeze the clock at given date and time.voidfreezeAt(ZonedDateTime zonedDateTime) Freeze the clock at given date and time.voidFreeze the clock at its current instant in time, which will be truncated to the given unit.voidSet the time to the given instant.voidSet the time of the clock to the given instant and zone.voidset(LocalDateTime localDateTime) Set the time to the given local date and time.voidset(OffsetDateTime offsetDateTime) Set the time to the given offset date and time.voidset(ZonedDateTime zonedDateTime) Set the time to the given zoned date and time.voidset(UnaryOperator<Clock> createNewClock) Set a new clock to resolve the time from.voidSet the time to freely progressing system time.voidsetToSystemClock(ZoneId zoneId) Set the time to freely progressing system time with the given zone.voidtimePasses(Duration amountOfTime) Signal that time is passing a given amount of time.voidtimePasses(TemporalAmount amountOfTime) Signal that time is passing a given amount of time.
-
Method Details
-
set
Set a new clock to resolve the time from.- Parameters:
createNewClock- function which is given the current clock, which may be used to create a new clock.
-
timePasses
Signal that time is passing a given amount of time.- Parameters:
amountOfTime- the amount of time which are passing.
-
timePasses
Signal that time is passing a given amount of time.- Parameters:
amountOfTime- the amount of time which are passing.
-
freezeAt
Freeze the clock at given instant andzone. -
freezeAt
Freeze the clock at given instant. -
freezeAt
Freeze the clock at given date and time. -
freezeAt
Freeze the clock at given date and time. -
freezeAt
Freeze the clock at given date and time. -
freeze
void freeze()Freeze the clock at its current instant in time. -
freezeTruncatedTo
Freeze the clock at its current instant in time, which will be truncated to the given unit.- Parameters:
unit- the unit the freezed instant will be truncated to- See Also:
-
setToSystemClock
Set the time to freely progressing system time with the given zone.- See Also:
-
setToSystemClock
void setToSystemClock()Set the time to freely progressing system time.- See Also:
-
set
Set the time of the clock to the given instant and zone.- Parameters:
instant- the instant to set.zone- the zone to set.
-
set
Set the time to the given instant.- Parameters:
instant- the instant to set.
-
set
Set the time to the given zoned date and time.- Parameters:
zonedDateTime- the date and time to set.
-
set
Set the time to the given offset date and time.- Parameters:
offsetDateTime- the date and time to set.
-
set
Set the time to the given local date and time.- Parameters:
localDateTime- the date and time to set.
-