Package org.salespointframework.time
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 Summary
Modifier and Type Method Description voidforward(Duration duration)Forwards the current time with the givenDuration.DurationgetOffset()Returns the current offset between the real time and the virtual one created by callingforward(Duration).LocalDateTimegetTime()Returns the current business time.voidreset()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.- Parameters:
duration-
-
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.
-