public abstract class Message extends Object
Kind
, a timestamp
and a cause
(which even is inherited, cf. Throwable.getCause()
!)MessageReceiver
) are very undemanding and
operate on this meager data.Modifier and Type | Class and Description |
---|---|
static class |
Message.Kind
Fundamental enum type for categorization of all
Message objects. |
Modifier and Type | Field and Description |
---|---|
protected Exception |
cause |
protected Message.Kind |
kind |
protected long |
timestamp |
Constructor and Description |
---|
Message(Exception e) |
Message(Message.Kind k) |
Message(Message.Kind k,
Exception e) |
Modifier and Type | Method and Description |
---|---|
RuntimeException |
explode()
Throws an exception carrying this message.
|
Exception |
getException()
HISTORIC RELICT:
return the "cause" which was specified when constructing.
|
Message.Kind |
getKind() |
StackTraceElement[] |
getStackTrace()
returns a
StackTraceElement [] taken from the
"cause", if there is one. |
long |
getTimeStamp()
returns the time when this message was constructed, encoded according to
System.currentTimeMillis() . |
boolean |
isCritical()
Distinguishes in many processing situations between
Message.Kind.error and
Message.Kind.failure vs all others. |
String |
render(Object... formatHints)
NOT YET OPERATIVE; simply calls
toString() |
String |
toString()
returns a debugging visualization with all attributes (kind, time, cause and
stacktrace), but not at all pretty.
|
protected Message.Kind kind
protected final long timestamp
protected Exception cause
public Message(Message.Kind k)
public Message(Message.Kind k, Exception e)
public Message(Exception e)
public final Message.Kind getKind()
public final boolean isCritical()
Message.Kind.error
and
Message.Kind.failure
vs all others.
Cf. Kind.isCritical()
.public final long getTimeStamp()
System.currentTimeMillis()
.public final Exception getException()
Throwable.getCause()
, but the
result is checked to be an exception.public final StackTraceElement[] getStackTrace()
StackTraceElement
[] taken from the
"cause", if there is one. getException()
. If this is
null, the method returns an empty array.public String toString()
public String render(Object... formatHints)
toString()
public RuntimeException explode()
RuntimeException
nevertheless. The calling code can
use this method as the argument to a throw
statement to
inform control flow analysis that the call never completes
normally.MessageException
see also the complete user documentation .