Package org.salespointframework.time
Interface BusinessTime
Component to allow access to the current business time. It will usually return the current system time but allows
manually forwarding it by a certain
Duration
for testing and simulation purposes.- Author:
- Paul Henke, Oliver Gierke, Rico Bergmann
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic final class
ADomainEvent
published on each day.static final class
ADomainEvent
published on the last day of the month. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Forwards the current time with the givenDuration
.Returns the current offset between the real time and the virtual one created by callingforward(Duration)
.getTime()
Returns the current business time.void
reset()
Undoes any forwarding.
-
Method Details
-
getTime
LocalDateTime getTime()Returns the current business time. This will be the time of the system the application is running on by default but can be adjusted by callingforward(Duration)
.- Returns:
-
forward
Forwards the current time with the givenDuration
. Calling the method multiple times will accumulate durations. For each day passed during the foward aBusinessTime.DayHasPassed
event will be published for application components to react to (e.g. viaEventListener
). Also, for each month passed, aBusinessTime.MonthHasPassed
event will be published the same way.- Parameters:
duration
- must not be null.
-
getOffset
Duration getOffset()Returns the current offset between the real time and the virtual one created by callingforward(Duration)
.- Returns:
-
reset
void reset()Undoes any forwarding. Afterwards any call togetTime()
will be equivalent to the system's time again.
-