S - The concrete type of the state object.public class LoggersHelper<S extends State> extends Object implements LoggerCollection<S>
| Modifier and Type | Field and Description |
|---|---|
protected Set<CommandLogger> |
commandLoggers
Set of unique command logger instances.
|
protected Set<EventLogger<S>> |
eventLoggers
Set of unique event logger instances.
|
| Constructor and Description |
|---|
LoggersHelper() |
| Modifier and Type | Method and Description |
|---|---|
void |
addCommandLogger(CommandLogger logger)
Add a command logger.
|
void |
addEventLogger(EventLogger<S> logger)
Add an event logger.
|
void |
addLogger(CombinedLogger<S> logger)
Add a logger instance that implements all supported logger interfaces.
|
void |
onCommandHandlerError(Throwable error,
Command command,
Collection<Event> events)
Called when an error occurs during the handling of a command.
|
void |
onCommandHandlerResult(Command command,
Collection<Event> events)
Called when a command handler returns a result.
|
void |
onEventHandlerError(Throwable error,
Event event,
S newState)
Called when an error occurs during the handling of an event.
|
void |
onEventHandlerResult(Event event,
S newState)
Called when an event handler returns a result.
|
protected final Set<CommandLogger> commandLoggers
protected final Set<EventLogger<S extends State>> eventLoggers
public void addCommandLogger(CommandLogger logger)
CommandLoggerAwareaddCommandLogger in interface CommandLoggerAwarelogger - The command logger to add.public void onCommandHandlerError(Throwable error, Command command, Collection<Event> events)
CommandLoggeronCommandHandlerError in interface CommandLoggererror - The error that occurred.command - The command that was handled.events - The resulting event(s). Note: command handlers are not required to produce
events.public void onCommandHandlerResult(Command command, Collection<Event> events)
CommandLoggeronCommandHandlerResult in interface CommandLoggercommand - The command that was handled.events - The resulting event(s). Note: command handlers are not required to produce
events.public void addEventLogger(EventLogger<S> logger)
EventLoggerAwareaddEventLogger in interface EventLoggerAware<S extends State>logger - The event logger to add.public void onEventHandlerError(Throwable error, Event event, S newState)
EventLoggeronEventHandlerError in interface EventLogger<S extends State>error - The error that occurred.event - The event that was handled.newState - The new state that was returned by the event handler.public void onEventHandlerResult(Event event, S newState)
EventLoggeronEventHandlerResult in interface EventLogger<S extends State>event - The event that was handled.newState - The new state that was returned by the event handler.public void addLogger(CombinedLogger<S> logger)
CombinedLoggerAwareaddLogger in interface CombinedLoggerAware<S extends State>logger - The logger to add.Copyright © 2016 Cooking Fox. All rights reserved.