Class Moments
java.lang.Object
org.springframework.modulith.moments.support.Moments
- All Implemented Interfaces:
Now
- Direct Known Subclasses:
TimeMachine
Core component to publish passage-of-time events.
- Author:
- Oliver Drotbohm, John Cunliffe
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classA method invocation to be scheduled perMomentsProperties.Granularity. -
Constructor Summary
ConstructorsConstructorDescriptionMoments(Clock clock, ApplicationEventPublisher events, MomentsProperties properties) -
Method Summary
Modifier and TypeMethodDescription(package private) voidTriggers event publication every hour.(package private) voidTriggers event publication every midnight.(package private) voidTriggers event publication every minute.(package private) voidTriggers event publication every second.Returns the methods to invoke for eachMomentsProperties.Granularity, bound to this instance.instant()Returns the current Instant.now()Returns the current point in time.(package private) Momentsreset()(package private) Momentstoday()Returns the current date.
-
Constructor Details
-
Moments
- Parameters:
clock- must not be null.events- must not be null.properties- must not be null.
-
-
Method Details
-
getTasksToBeScheduled
Returns the methods to invoke for eachMomentsProperties.Granularity, bound to this instance.- Returns:
- will never be null.
-
everySecond
void everySecond()Triggers event publication every second. -
everyMinute
void everyMinute()Triggers event publication every minute. -
everyHour
void everyHour()Triggers event publication every hour. -
everyMidnight
void everyMidnight()Triggers event publication every midnight. -
shiftBy
-
reset
Moments reset() -
now
Description copied from interface:NowReturns the current point in time. -
today
Description copied from interface:NowReturns the current date. -
instant
Description copied from interface:NowReturns the current Instant.
-