Class MuLiMessageReceiver<D>

java.lang.Object
eu.bandm.tools.message.SingleSender<SimpleMessage<D>>
eu.bandm.tools.muli.MuLiMessageReceiver<D>
All Implemented Interfaces:
MessageReceiver<SimpleMessage<D>>
Direct Known Subclasses:
MuLiMessageStore

public class MuLiMessageReceiver<D> extends SingleSender<SimpleMessage<D>> implements MessageReceiver<SimpleMessage<D>>
Deprecated.
All messages support now muli; use MessageTranslator instead A subclass of MessageReceiver, providing convenience methods for generating and translating SimpleMessages.

The translation process is defined by an non-null instance of CatalogByString and a (normally non-empty) list of language preferences, as needed by MuLi.

A MuLiMessageReceiver is mostly used as a generator for messages: By calling the different generating methods error(...), log(...), warning(...), etc., a SimpleMessage is constructed (similar to the construction API in SimpleMessage.Sender) and sent to the one currently connected receiver, as defined by SingleSender. For this constructing, the message text itself and all embedded components will (1) be translated separately and then (2) combined by String formatting as described with Catalog#translateAllAndFormatRobust(String,List<String>,Object...).
For convenience, since in nearly every application context errors and warnings have to be detected by counting, a MessageCounter is fed in parallel with the connected receiver. This can be retrieved by getCounter(), and further inquired or reset, etc.

For compatibility, instances of this class may also be used as message receivers as defined by MessageReceiver. Then they propagate all received messages after translating the text component as a whole. This is only sensible in the (rare) cases when the message texts are constants as a whole, i.e. do not contain variable sub-texts.