Package eu.bandm.tools.muli
Class 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.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected CatalogByString
Deprecated.protected MessageCounter
Deprecated.Deprecated.static final String
Deprecated.Fields inherited from class eu.bandm.tools.message.SingleSender
receiver
-
Constructor Summary
ConstructorsConstructorDescriptionMuLiMessageReceiver
(MessageReceiver<SimpleMessage<D>> receiver, CatalogByString cat, String... prefs) Deprecated.MuLiMessageReceiver
(MessageReceiver<SimpleMessage<D>> receiver, CatalogByString cat, List<String> prefs) Deprecated. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Deprecated.void
Deprecated.(1) Translate thetext
and allargs
, then (2) construct aSimpleMessage
and (3) send it to the currentSingleSender.receiver
.void
Deprecated.void
Deprecated.void
Deprecated.void
Deprecated.Deprecated.Deprecated.int
Deprecated.Returns the number of new critical errors occured after the last call tomarkCriticalErrors()
getPrefs()
Deprecated.void
Deprecated.void
Deprecated.void
Deprecated.void
Deprecated.void
Deprecated.void
Deprecated.void
Deprecated.void
Deprecated.void
Deprecated.void
Deprecated.void
Deprecated.void
Deprecated.int
Deprecated.Stores the number of critical errors for later retrieval bygetMarkedErros()
.static <X> MuLiMessageReceiver<X>
noTranslate
(MessageReceiver<SimpleMessage<X>> rec) Deprecated.Wrap a MessageReceiver into a MuLiMessageReceiver with NOT TRANSLATION at all.void
receive
(SimpleMessage<D> msg) Deprecated.Evidentprotected void
Deprecated.protected void
Deprecated.void
send
(MuLiException exc) Deprecated.void
setCatalog
(CatalogByString catalog) Deprecated.void
setPreferences
(String... prefs) Deprecated.void
setPreferences
(List<String> prefs) Deprecated.void
Deprecated.void
terminateApplicationOnErrors
(int returnCode) Deprecated.void
Deprecated.void
Deprecated.void
Deprecated.Methods inherited from class eu.bandm.tools.message.SingleSender
getReceiver, send, setReceiver
-
Field Details
-
catalog
Deprecated. -
prefs
Deprecated. -
counter
Deprecated. -
terminationText
Deprecated.- See Also:
-
-
Constructor Details
-
MuLiMessageReceiver
public MuLiMessageReceiver(MessageReceiver<SimpleMessage<D>> receiver, CatalogByString cat, String... prefs) Deprecated.- Parameters:
cat
- defines the translation process. must be!=null
.receiver
- where to send the constructed (or propagated) messages.
-
MuLiMessageReceiver
public MuLiMessageReceiver(MessageReceiver<SimpleMessage<D>> receiver, CatalogByString cat, List<String> prefs) Deprecated.
-
-
Method Details
-
noTranslate
Deprecated.Wrap a MessageReceiver into a MuLiMessageReceiver with NOT TRANSLATION at all. -
setCatalog
Deprecated. -
getCatalog
Deprecated. -
setPreferences
Deprecated. -
setPreferences
Deprecated. -
getPrefs
Deprecated. -
receive
Deprecated.Description copied from interface:MessageReceiver
Evident- Specified by:
receive
in interfaceMessageReceiver<D>
-
getCounter
Deprecated. -
markCriticalErrors
public int markCriticalErrors()Deprecated.Stores the number of critical errors for later retrieval bygetMarkedErros()
. -
getMarkedErros
public int getMarkedErros()Deprecated.Returns the number of new critical errors occured after the last call tomarkCriticalErrors()
-
terminateApplicationOnErrors
public void terminateApplicationOnErrors(int returnCode) Deprecated. -
terminateApplicationOnErrors
public void terminateApplicationOnErrors()Deprecated. -
send
Deprecated. -
send
protected void send(Message.Kind kind, Exception cause, Location<D> loc, String txt, Object... args) Deprecated. -
send
protected void send(Message.Kind kind, Exception cause, Location<D> loc, String txt, List<Object> args) Deprecated. -
error
Deprecated.(1) Translate thetext
and allargs
, then (2) construct aSimpleMessage
and (3) send it to the currentSingleSender.receiver
.
The translation is ruled by the current value ofprefs
and the contents ofcatalog
, which must be != null. The translation is done by delegation to {@link Catalog.translateAllAndFormatRobust(String,String[],,Object...)}
Thetype
of the constructed method isMessage.Kind.error
.
The code crashes intentionally if noSingleSender.receiver
is set, as described in the user documentation
All these convenience methods start with an Exception argument, followed by a Location. There is one additional variant which leaves out the initial Exception. As a consequence, the Location can be set to null NOT NEEDING casting, if an Exception is present. -
warning
Deprecated. -
failure
Deprecated. -
hint
Deprecated. -
log
Deprecated. -
logStart
Deprecated. -
logEnd
Deprecated. -
error
Deprecated. -
warning
Deprecated. -
failure
Deprecated. -
hint
Deprecated. -
log
Deprecated. -
logStart
Deprecated. -
logEnd
Deprecated. -
error
Deprecated. -
warning
Deprecated. -
failure
Deprecated. -
hint
Deprecated. -
log
Deprecated. -
logStart
Deprecated. -
logEnd
Deprecated.
-
MessageTranslator
instead A subclass ofMessageReceiver
, providing convenience methods for generating and translatingSimpleMessage
s.The translation process is defined by an non-null instance of
CatalogByString
and a (normally non-empty) list of language preferences, as needed byMuLi
.A
MuLiMessageReceiver
is mostly used as a generator for messages: By calling the different generating methodserror(...)
,log(...)
,warning(...)
, etc., aSimpleMessage
is constructed (similar to the construction API inSimpleMessage.Sender
) and sent to the one currently connected receiver, as defined bySingleSender
. 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 withCatalog#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 bygetCounter()
, 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.