Class SimpleMessage.LocationMapper<D,E>

java.lang.Object
eu.bandm.tools.message.SingleSender<SimpleMessage<E>>
eu.bandm.tools.message.SimpleMessage.LocationMapper<D,E>
Type Parameters:
D - the type of the document identifier of the incoming locations
E - the type of the document identifier of the outcoming locations
All Implemented Interfaces:
MessageReceiver<SimpleMessage<D>>
Enclosing class:
SimpleMessage<D>

public static class SimpleMessage.LocationMapper<D,E> extends SingleSender<SimpleMessage<E>> implements MessageReceiver<SimpleMessage<D>>
Passes all incoming messages to its drain, after applying the given location map.

As with every SingleSender, the receiver must be set to a non-null value before the first message is received. Otherwise the code will crash intentionally.

(Since in and out locations can be of different type, this general class cannot extend MessagePasser.)

  • Field Details

  • Constructor Details

  • Method Details

    • receive

      public void receive(SimpleMessage<D> msg)
      Receive a message, apply the mapping to its location, and send it to the current receiver.
      Specified by:
      receive in interface MessageReceiver<D>
      Parameters:
      msg - the message to receive.