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
Modifier and TypeFieldDescriptionEvidentstatic final int
Value of level, unless explicitly given.static final StackTraceElement[]
Evidentprotected final Message.Kind
Evidentprotected int
Numeric qualification, can by used to realize levels of verbosity.protected final long
The system time when this message is created. -
Constructor Summary
ModifierConstructorDescriptionprotected
Creates a message ofMessage.Kind.failure
kind.protected
Creates a clone, but with newer date,protected
Create a message with only kind and timestamp setprotected
Message
(Message.Kind k, int v) Create a message with kind, level and timestamp setprotected
Message
(Message.Kind k, int v, @Opt Throwable e) Create a message with kind, level, cause 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 int
getLevel()
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 -
DEFAULT_LEVEL
public static final int DEFAULT_LEVELValue of level, unless explicitly given.- See Also:
-
level
protected int levelNumeric qualification, can by used to realize levels of verbosity. -
emptyStackTrace
Evident
-
-
Constructor Details
-
Message
Create a message with only kind and timestamp set -
Message
Create a message with kind, cause and timestamp set -
Message
Create a message with kind, level and timestamp set -
Message
Create a message with kind, level, cause and timestamp set -
Message
Creates a message ofMessage.Kind.failure
kind. -
Message
Creates a clone, but with newer date,
-
-
Method Details
-
getKind
Evident -
getLevel
public final int getLevel()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 by
getCause()
. Iff 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 the Java compiler's control flow analysis that the call never completes normally. - Throws:
MessageException
-