ApplicationContextEvent.withClock constructor

ApplicationContextEvent.withClock(
  1. ApplicationContext source,
  2. DateTime clock()
)

A base class for all events that are published within the context of an ApplicationContext.

This class is an extension of ApplicationEvent that ensures the source of the event is always an ApplicationContext. It is intended to be subclassed for specific types of application context lifecycle events such as context refresh, close, or start.


Example:

class ContextRefreshedEvent extends ApplicationContextEvent {
  ContextRefreshedEvent(ApplicationContext source) : super(source);
}

void handle(ContextRefreshedEvent event) {
  final context = event.getSource();
  print("Application context refreshed: $context");
}

This abstraction allows for strongly typed event listeners specific to the lifecycle of the JetLeaf application context.

Implementation

ApplicationContextEvent.withClock(ApplicationContext source, DateTime Function() clock) : super.withClock(source, clock);