Class ActionHandlerSet<T>
- java.lang.Object
-
- de.quantummaid.eventmaid.channel.action.ActionHandlerSet<T>
-
- Type Parameters:
T- the type of messages of theChannel
public final class ActionHandlerSet<T> extends Object
TheActionHandlerSetdefines the mapping ofActionsto their respectiveActionHandler.Each
Channelhas anActionHandlerSetset during creation. Only thoseActionscan be used as finalActionof theChannel, that have a matchingActionHandlerregistered in the set.- See Also:
- EventMaid Documentation
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static <T> ActionHandlerSet<T>emptyActionHandlerSet()Creates a new, emptyActionHandlerSet.ActionHandler<Action<T>,T>getActionHandlerFor(Action<T> action)Returns theActionHandlerregistered for the given action.voidregisterActionHandler(Class<? extends Action> actionClass, ActionHandler<? extends Action<T>,T> actionHandler)Method, that can be used to add anActionand itsActionHandlerdynamically to the set.
-
-
-
Method Detail
-
emptyActionHandlerSet
public static <T> ActionHandlerSet<T> emptyActionHandlerSet()
Creates a new, emptyActionHandlerSet.- Type Parameters:
T- the type of messages of theChannel- Returns:
- a new, empty
ActionHandlerSet
-
getActionHandlerFor
public ActionHandler<Action<T>,T> getActionHandlerFor(Action<T> action)
Returns theActionHandlerregistered for the given action.- Parameters:
action- the action for which the handler is queried- Returns:
- the
ActionHandlerif one is present - Throws:
NoHandlerForUnknownActionException- if noActionHandlerfor theActionexists
-
registerActionHandler
public void registerActionHandler(Class<? extends Action> actionClass, ActionHandler<? extends Action<T>,T> actionHandler)
Method, that can be used to add anActionand itsActionHandlerdynamically to the set. Can be used to overwrite existing mappings.- Parameters:
actionClass- theActionfor which the handler should be addedactionHandler- theActionHandler
-
-