public class LaPasseFacadeDelegate<S extends State> extends Object implements Facade<S>
Facade operations to a provided instance.| Modifier and Type | Field and Description |
|---|---|
protected Facade<S> |
facade
The facade instance to use as delegate.
|
| Constructor and Description |
|---|
LaPasseFacadeDelegate(Facade<S> facade) |
| 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 |
addStateChangedListener(OnStateChanged<S> listener)
Add listener for when the state changed.
|
void |
dispose()
Hook for cleaning up: remove listeners, shutdown threads, etc.
|
S |
getCurrentState()
Returns the current state.
|
void |
handleCommand(Command command)
Execute the command handler that is mapped to this command type.
|
void |
handleEvent(Event event)
Execute the event handler that is mapped to this event type.
|
<C extends Command,E extends Event> |
mapCommandHandler(Class<C> commandClass,
CommandHandler<S,C,E> commandHandler)
Map a command handler for a concrete command type.
|
<E extends Event> |
mapEventHandler(Class<E> eventClass,
EventHandler<S,E> eventHandler)
Map a event handler for a concrete event type.
|
void |
removeCommandLogger(CommandLogger logger)
Remove a command logger.
|
void |
removeEventLogger(EventLogger<S> logger)
Remove an event logger.
|
void |
removeLogger(CombinedLogger<S> logger)
Remove a logger instance that implements all supported logger interfaces.
|
void |
removeStateChangedListener(OnStateChanged<S> listener)
Remove previously added state changed listener.
|
void |
setCommandHandlerExecutor(ExecutorService executor)
Sets the executor service that will run async command handlers.
|
public void addLogger(CombinedLogger<S> logger)
CombinedLoggerAwareaddLogger in interface CombinedLoggerAware<S extends State>logger - The logger to add.public void removeLogger(CombinedLogger<S> logger)
CombinedLoggerAwareremoveLogger in interface CombinedLoggerAware<S extends State>logger - The logger to remove.public void addCommandLogger(CommandLogger logger)
CommandLoggerAwareaddCommandLogger in interface CommandLoggerAwarelogger - The command logger to add.public void handleCommand(Command command)
CommandBushandleCommand in interface CommandBus<S extends State>command - The command to handle.CommandBus.mapCommandHandler(Class, CommandHandler)public <C extends Command,E extends Event> void mapCommandHandler(Class<C> commandClass, CommandHandler<S,C,E> commandHandler)
CommandBusmapCommandHandler in interface CommandBus<S extends State>C - The concrete command type that this handler will handle.E - The concrete event type that this handler will produce.commandClass - The concrete command type that this handler will handle.commandHandler - The handler that is executed when CommandBus.handleCommand(Command) is
called.public void removeCommandLogger(CommandLogger logger)
CommandLoggerAwareremoveCommandLogger in interface CommandLoggerAwarelogger - The command logger to remove.public void setCommandHandlerExecutor(ExecutorService executor)
CommandBussetCommandHandlerExecutor in interface CommandBus<S extends State>executor - The executor service to use.public void dispose()
Disposabledispose in interface Disposablepublic void addEventLogger(EventLogger<S> logger)
EventLoggerAwareaddEventLogger in interface EventLoggerAware<S extends State>logger - The event logger to add.public void handleEvent(Event event)
EventBushandleEvent in interface EventBus<S extends State>event - The event to handle.EventBus.mapEventHandler(Class, EventHandler)public <E extends Event> void mapEventHandler(Class<E> eventClass, EventHandler<S,E> eventHandler)
EventBusmapEventHandler in interface EventBus<S extends State>E - The concrete event type that this handler will produce.eventClass - The concrete event type that this handler will handle.eventHandler - The handler that is executed when EventBus.handleEvent(Event) is
called.public void removeEventLogger(EventLogger<S> logger)
EventLoggerAwareremoveEventLogger in interface EventLoggerAware<S extends State>logger - The event logger to remove.public void addStateChangedListener(OnStateChanged<S> listener)
StateObserveraddStateChangedListener in interface StateObserver<S extends State>listener - The listener to notify when the state changes.public S getCurrentState()
StateObservergetCurrentState in interface StateObserver<S extends State>public void removeStateChangedListener(OnStateChanged<S> listener)
StateObserverremoveStateChangedListener in interface StateObserver<S extends State>listener - The listener to remove.Copyright © 2016 Cooking Fox. All rights reserved.