Package io.fluxcapacitor.common
Class DelegatingClock
java.lang.Object
java.time.Clock
io.fluxcapacitor.common.DelegatingClock
- All Implemented Interfaces:
InstantSource
A concrete implementation of a
Clock
that delegates its method calls to another Clock
instance, allowing runtime manipulation of the delegated clock.
This class is useful when you need to dynamically switch the clock's implementation during runtime, for example, testing scenarios requiring adjustable or controlled time flows.
The delegated clock instance is stored atomically to ensure thread-safe updates.
-
Constructor Summary
Constructors -
Method Summary
Methods inherited from class java.time.Clock
equals, fixed, hashCode, millis, offset, system, systemDefaultZone, systemUTC, tick, tickMillis, tickMinutes, tickSeconds
-
Constructor Details
-
DelegatingClock
public DelegatingClock()
-
-
Method Details
-
setDelegate
-
getZone
-
withZone
- Specified by:
withZone
in interfaceInstantSource
- Specified by:
withZone
in classClock
-
instant
- Specified by:
instant
in interfaceInstantSource
- Specified by:
instant
in classClock
-