Class ActionHandlerSet<T>

  • Type Parameters:
    T - the type of messages of the Channel

    public final class ActionHandlerSet<T>
    extends Object
    The ActionHandlerSet defines the mapping of Actions to their respective ActionHandler.

    Each Channel has an ActionHandlerSet set during creation. Only those Actions can be used as final Action of the Channel, that have a matching ActionHandler registered in the set.

    See Also:
    EventMaid Documentation
    • Method Detail

      • emptyActionHandlerSet

        public static <T> ActionHandlerSet<T> emptyActionHandlerSet()
        Creates a new, empty ActionHandlerSet.
        Type Parameters:
        T - the type of messages of the Channel
        Returns:
        a new, empty ActionHandlerSet
      • getActionHandlerFor

        public ActionHandler<Action<T>,​T> getActionHandlerFor​(Action<T> action)
        Returns the ActionHandler registered for the given action.
        Parameters:
        action - the action for which the handler is queried
        Returns:
        the ActionHandler if one is present
        Throws:
        NoHandlerForUnknownActionException - if no ActionHandler for the Action exists
      • registerActionHandler

        public void registerActionHandler​(Class<? extends Action> actionClass,
                                          ActionHandler<? extends Action<T>,​T> actionHandler)
        Method, that can be used to add an Action and its ActionHandler dynamically to the set. Can be used to overwrite existing mappings.
        Parameters:
        actionClass - the Action for which the handler should be added
        actionHandler - the ActionHandler