Package eu.bandm.tools.message
Class Message
java.lang.Object
eu.bandm.tools.message.Message
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
SimpleMessage
Abstract base class of the metatools message architecture.
Does have as attributes only a
Does have as attributes only a
Kind
, a timestamp
and a cause
.
All message processing classes in this package (derived from
MessageReceiver
) operate on this data.- See Also:
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
Fundamental enum type for categorization of allMessage
objects. -
Field Summary
-
Constructor Summary
ModifierConstructorDescriptionprotected
Creates a message ofMessage.Kind.failure
kind.protected
Create a message with only kind and timestamp setprotected
Message
(Message.Kind k, @Opt Throwable e) Create a message with kind, cause and timestamp set -
Method Summary
Modifier and TypeMethodDescriptionexplode()
Throws an exception carrying this message.getCause()
Evidentfinal Message.Kind
getKind()
Evidentfinal StackTraceElement[]
returns aStackTraceElement
[] taken from the "cause", if there is one.final long
returns the time when this message was constructed.final boolean
Distinguishes in many processing situations betweenMessage.Kind.error
andMessage.Kind.failure
as "critical" and all others as "uncritical".toString()
Delivers a primitive visualisation, required for tracing and debugging.
-
Field Details
-
kind
Evident -
timestamp
protected final long timestampThe system time when this message is created. -
cause
Evident
-
-
Constructor Details
-
Message
Create a message with only kind and timestamp set -
Message
Create a message with kind, cause and timestamp set -
Message
Creates a message ofMessage.Kind.failure
kind.
-
-
Method Details
-
getKind
Evident -
isCritical
public final boolean isCritical()Distinguishes in many processing situations betweenMessage.Kind.error
andMessage.Kind.failure
as "critical" and all others as "uncritical". SeeKind.isCritical()
. -
getTimeStamp
public final long getTimeStamp()returns the time when this message was constructed. It is encoded according toSystem.currentTimeMillis()
. -
getCause
Evident -
getStackTrace
returns aStackTraceElement
[] taken from the "cause", if there is one.
The "cause" is the Throwable returned bygetCause()
. If this is null, the method returns an empty array. -
toString
Delivers a primitive visualisation, required for tracing and debugging. An actual user-levelMessagePrinter
or sim., will provide much more elaborate rendering. -
explode
Throws an exception carrying this message.- Returns:
- nothing; the return type is
RuntimeException
nevertheless. The calling code can use this method as the argument to athrow
statement to inform control flow analysis that the call never completes normally. - Throws:
MessageException
-