Class 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 a Kind, a timestamp and a cause. All message processing classes in this package (derived from MessageReceiver) operate on this data.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  Message.Kind
      Fundamental enum type for categorization of all Message objects.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected @Opt java.lang.Throwable cause
      Evident
      protected Message.Kind kind
      Evident
      protected long timestamp
      The system time when this message is created.
    • Constructor Summary

      Constructors 
      Constructor Description
      Message​(@Opt java.lang.Throwable e)
      Creates a message of Kind.failure kind.
      Message​(Message.Kind k)
      Create a message with only kind and timestamp set
      Message​(Message.Kind k, @Opt java.lang.Throwable e)
      Create a message with kind, cause and timestamp set
    • Field Detail

      • timestamp

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

        @Opt
        protected @Opt java.lang.Throwable cause
        Evident
    • 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
      • Message

        public Message​(@Opt
                       @Opt java.lang.Throwable e)
        Creates a message of Kind.failure kind.
    • Method Detail

      • getTimeStamp

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

        @Deprecated
        @Opt
        public final @Opt java.lang.Throwable getThrowable()
        Deprecated.
        use getCause() instead, because the type of the field is now Throwable.
      • getCause

        @Opt
        public final @Opt java.lang.Throwable getCause()
        Evident
      • getStackTrace

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