Package eu.bandm.tools.message
Class Message
- java.lang.Object
-
- eu.bandm.tools.message.Message
-
- Direct Known Subclasses:
SimpleMessage
public abstract class Message extends java.lang.Object
Abstract base class of the metatools message architecture.
Does have as attributes only aKind
, atimestamp
and acause
. All message processing classes in this package (derived fromMessageReceiver
) operate on this data.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Message.Kind
Fundamental enum type for categorization of allMessage
objects.
-
Field Summary
Fields Modifier and Type Field Description protected @Opt java.lang.Throwable
cause
Evidentprotected Message.Kind
kind
Evidentprotected long
timestamp
The system time when this message is created.
-
Constructor Summary
Constructors Constructor Description Message(@Opt java.lang.Throwable e)
Creates a message ofKind.failure
kind.Message(Message.Kind k)
Create a message with only kind and timestamp setMessage(Message.Kind k, @Opt java.lang.Throwable e)
Create a message with kind, cause and timestamp set
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description java.lang.RuntimeException
explode()
Throws an exception carrying this message.@Opt java.lang.Throwable
getCause()
EvidentMessage.Kind
getKind()
Evidentjava.lang.StackTraceElement[]
getStackTrace()
returns aStackTraceElement
[] taken from the "cause", if there is one.@Opt java.lang.Throwable
getThrowable()
Deprecated.usegetCause()
instead, because the type of the field is nowThrowable
.long
getTimeStamp()
returns the time when this message was constructed.boolean
isCritical()
Distinguishes in many processing situations betweenMessage.Kind.error
andMessage.Kind.failure
as "critical" and all others as "uncritical".java.lang.String
toString()
Delivers a primitive visualisation, required for tracing and debugging.
-
-
-
Field Detail
-
kind
protected final Message.Kind kind
Evident
-
timestamp
protected final long timestamp
The system time when this message is created.
-
-
Constructor Detail
-
Message
public Message(Message.Kind k)
Create a message with only kind and timestamp set
-
Message
public Message(Message.Kind k, @Opt @Opt java.lang.Throwable e)
Create a message with kind, cause and timestamp set
-
-
Method Detail
-
getKind
public final Message.Kind 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()
.
-
getThrowable
@Deprecated @Opt public final @Opt java.lang.Throwable getThrowable()
Deprecated.usegetCause()
instead, because the type of the field is nowThrowable
.
-
getStackTrace
public final java.lang.StackTraceElement[] 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
public java.lang.String toString()
Delivers a primitive visualisation, required for tracing and debugging. An actual user-levelMessagePrinter
or sim., will provide much more elaborate rendering.- Overrides:
toString
in classjava.lang.Object
-
explode
public java.lang.RuntimeException 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
-
-