Class MessageDemux.ByKind<M extends Message>

All Implemented Interfaces:
MessageReceiver<M>
Enclosing class:
MessageDemux<E extends Enum<E>,M extends Message>

public static class MessageDemux.ByKind<M extends Message> extends MessageDemux<Message.Kind,M>
A MessageDemux which sorts messages by their kind. This class is an instantiation of MessageDemux with Message.Kind as index type. So its map can contain one MessageReceiver for each value of this enumeration. Every message is propagated to the receiver indicated by Message.getKind().
  • Constructor Details

    • ByKind

      public ByKind()
      Only constructor.
  • Method Details

    • getOutputTags

      protected EnumSet<Message.Kind> getOutputTags(Message m)
      Has to be re-defined by derived classes to calculate the set of enum items which indicate the receivers the message shall be propagated to.

      This is the only method which needs to be overrideden by a subclass to be operative.

      Specified by:
      getOutputTags in class MessageDemux<Message.Kind,M extends Message>
      Parameters:
      m - the message to be sent.
      Returns:
      all tags to which this message shall be sent.