Interface BusinessTime


@Service public 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
  • 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 calling forward(Duration).
      Returns:
    • forward

      void forward(Duration duration)
      Forwards the current time with the given Duration. Calling the method multiple times will accumulate durations. For each day passed during the foward a BusinessTime.DayHasPassed event will be published for application components to react to (e.g. via EventListener). Also, for each month passed, a BusinessTime.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 calling forward(Duration).
      Returns:
    • reset

      void reset()
      Undoes any forwarding. Afterwards any call to getTime() will be equivalent to the system's time again.