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, resp. on a subclass thereof.- 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[]
Evident.protected final Message.Kind
Evidentprotected int
Numeric qualification, can by used to realize levels of verbosity.protected long
The system time when this message is created. -
Constructor Summary
ModifierConstructorDescriptionprotected
Creates a clone, but with newer date,protected
Create a message with only kind and timestamp set.protected
Message
(Message.Kind k, int v) Create a message with kind, level and timestamp set.protected
Message
(Message.Kind k, int v, @Opt Throwable e) Create a message with kind, level, cause and timestamp set.protected
Message
(Message.Kind k, @Opt Throwable e) Create a message with kind, cause and timestamp set.protected
Creates a message ofMessage.Kind.failure
kind. -
Method Summary
Modifier and TypeMethodDescription(package private) void
adjustTimeStamp
(long ts) Not public, only for internal re-adjustment after a clone.explode()
Throws an exception carrying this message.getCause()
Evident.final Message.Kind
getKind()
Evident.final int
getLevel()
Evident.final 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 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.- Parameters:
k
- the kind of the message.
-
Message
Create a message with kind, cause and timestamp set.- Parameters:
k
- the kind of the messaage.e
- the cause of the messaage.
-
Message
Create a message with kind, level and timestamp set.- Parameters:
k
- the kind of the messaage.v
- the level of the messaage.
-
Message
Create a message with kind, level, cause and timestamp set.- Parameters:
k
- the kind of the messaage.v
- the level of the messaage.e
- the cause of the messaage.
-
Message
Creates a message ofMessage.Kind.failure
kind.- Parameters:
e
- the cause of the messaage.
-
Message
Creates a clone, but with newer date,- Parameters:
original
- the message to clone.
-
-
Method Details
-
getKind
Evident.- Returns:
- the kind of the message.
-
getLevel
public final int getLevel()Evident.- Returns:
- the level of the message.
-
adjustTimeStamp
void adjustTimeStamp(long ts) Not public, only for internal re-adjustment after a clone. -
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()
.- Returns:
- whether the message is of kind failure or error.
-
getTimeStamp
public final long getTimeStamp()Returns the time when this message was constructed. It is encoded according toSystem.currentTimeMillis()
.- Returns:
- the time when this message was constructed.
-
getCause
Evident.- Returns:
- the cause of the message.
-
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.- Returns:
- the stack trace form the ".cause", if there is any,
-
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
- which encapsulates this Message
-