Class SingleSender<M extends Message>

java.lang.Object
eu.bandm.tools.message.SingleSender<M>
Type Parameters:
M - the message subtype propagated by this sender
Direct Known Subclasses:
MessageAsync, MessageCatcher, MessageKindFilter, MessageLocationFilter, MessageMapper, MessagePasser, MessageStripExceptions, MessageSync, SimpleMessage.LocationMapper, SimpleMessage.Sender

public abstract class SingleSender<M extends Message> extends Object
Common superclass of all which send messages to one single drain.

This includes some "genuine message sources", ie. senders only, but most of the subclasses are MessageReceivers, which pass on the received messages to one single drain.

This drain can be enquired and set, ie. it can change dynamically during execution. Intentionally, the code will crash if a receiver==null and a send is attempted
  • Field Details

  • Constructor Details

  • Method Details

    • setReceiver

      public void setReceiver(@Opt @Opt MessageReceiver<? super M> r)
      Evident.
      Parameters:
      r - the receiver of the sent messages.
    • getReceiver

      @Opt public @Opt MessageReceiver<? super M> getReceiver()
      Evident.
      Returns:
      the currently active receiver.
    • send

      protected void send(M m)
      Used to pass on a message to the current receiver.
      Intentionally, the code will crash if this is ==null
      Parameters:
      m - the message to be sent to the current receiver.