java.lang.Object
org.springframework.modulith.moments.support.Moments
All Implemented Interfaces:
Now
Direct Known Subclasses:
TimeMachine

public class Moments extends Object implements Now
Core component to publish passage-of-time events.
Author:
Oliver Drotbohm
  • Constructor Details

  • Method Details

    • everyHour

      @Scheduled(cron="@hourly") void everyHour()
      Triggers event publication every hour.
    • everyMidnight

      @Scheduled(cron="@daily") void everyMidnight()
      Triggers event publication every midnight.
    • shiftBy

      Moments shiftBy(Duration duration)
    • now

      public LocalDateTime now()
      Description copied from interface: Now
      Returns the current point in time.
      Specified by:
      now in interface Now
      Returns:
      will never be null.
    • today

      public LocalDate today()
      Description copied from interface: Now
      Returns the current date.
      Specified by:
      today in interface Now
      Returns:
      will never be null.
    • instant

      public Instant instant()
      Description copied from interface: Now
      Returns the current Instant.
      Specified by:
      instant in interface Now
      Returns:
      will never be null.