Class MessageDemux.ByKind<M extends Message>

Type Parameters:
M - the type of the messages
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 message de-multiplexer 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)
      Calculate the set of enum items which indicate the receivers the message shall be propagated to. This class returns the kind of the message, for propagating it to one single receiver.
      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.