Class Message

java.lang.Object
eu.bandm.tools.message.Message
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
SimpleMessage

public abstract class Message extends Object implements Serializable
Abstract base class of the metatools message architecture.
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:
  • Field Details

    • kind

      protected final Message.Kind kind
      Evident
    • timestamp

      protected final long timestamp
      The system time when this message is created.
    • cause

      @Opt protected @Opt Throwable cause
      Evident
  • Constructor Details

  • Method Details

    • getKind

      public final Message.Kind getKind()
      Evident
    • isCritical

      public final boolean isCritical()
      Distinguishes in many processing situations between Message.Kind.error and Message.Kind.failure as "critical" and all others as "uncritical". See Kind.isCritical().
    • getTimeStamp

      public final long getTimeStamp()
      returns the time when this message was constructed. It is encoded according to System.currentTimeMillis().
    • getCause

      @Opt public final @Opt Throwable getCause()
      Evident
    • getStackTrace

      public final StackTraceElement[] getStackTrace()
      returns a StackTraceElement[] taken from the "cause", if there is one.

      The "cause" is the Throwable returned by getCause(). If this is null, the method returns an empty array.
    • toString

      public String toString()
      Delivers a primitive visualisation, required for tracing and debugging. An actual user-level MessagePrinter or sim., will provide much more elaborate rendering.
      Overrides:
      toString in class Object
    • explode

      public 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 a throw statement to inform control flow analysis that the call never completes normally.
      Throws:
      MessageException