Package eu.bandm.tools.message
Class MessagePasser<M extends Message>
java.lang.Object
eu.bandm.tools.message.SingleSender<M>
eu.bandm.tools.message.MessagePasser<M>
- Type Parameters:
M
- the message subtype propagated by this sender
- All Implemented Interfaces:
MessageReceiver<M>
- Direct Known Subclasses:
LLJavac.Messager
,MessageFormatter
,MessageTranslator
Simply passes every message it receives to a single target.
Is intented as a basis class for overriding the
receive(M)
method
and thus implementing filters and on-the-fly transformations.-
Field Summary
Fields inherited from class eu.bandm.tools.message.SingleSender
receiver
-
Constructor Summary
ConstructorDescriptionAfter calling this constructor, a call toSingleSender.setReceiver(MessageReceiver)
is necessary.MessagePasser
(MessageReceiver<? super M> r) Constructor which sets the receiver. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Will pass the received message to the currentSingleSender.receiver
.Methods inherited from class eu.bandm.tools.message.SingleSender
getReceiver, send, setReceiver
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface eu.bandm.tools.message.MessageReceiver
ifSubcriticalThen, ifSubcriticalThen, ifSubcriticalThenElse
-
Constructor Details
-
MessagePasser
public MessagePasser()After calling this constructor, a call toSingleSender.setReceiver(MessageReceiver)
is necessary. Cf the documentation ofSingleSender
. -
MessagePasser
Constructor which sets the receiver.- Parameters:
r
- Receiver
-
-
Method Details
-
receive
Will pass the received message to the currentSingleSender.receiver
.
Intentionally, the code will crash if this is==null
- Specified by:
receive
in interfaceMessageReceiver<M extends Message>
- Parameters:
m
- the message to receive.
-