Class Message<H extends MessageHeaders,​B>

  • Type Parameters:
    H - message head type.
    B - message body type.

    public final class Message<H extends MessageHeaders,​B>
    extends java.lang.Object
    Generic message consisting of a message head and a message body.
    Since:
    5.0
    • Constructor Summary

      Constructors 
      Constructor Description
      Message​(H head)
      Constructs a new instance.
      Message​(H head, B body)
      Constructs a new instance.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      B body()
      Gets the message body.
      java.lang.Object error()  
      static <H extends MessageHeaders,​B>
      Message<H,​B>
      error​(H head, java.lang.Object error)
      Create a new message with the given head and error.
      B getBody()
      Gets the message body.
      H getHead()
      Gets the message head.
      H head()
      Gets the message head.
      static <H extends MessageHeaders,​B>
      Message<H,​B>
      of​(H head, B body)
      Create a new message with the given head and body, and no error.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • Message

        public Message​(H head)
        Constructs a new instance.
        Parameters:
        head - The message head.
        Since:
        5.3
      • Message

        public Message​(H head,
                       B body)
        Constructs a new instance.
        Parameters:
        head - The message head.
        body - The message body.
    • Method Detail

      • of

        public static <H extends MessageHeaders,​B> Message<H,​B> of​(H head,
                                                                               B body)
        Create a new message with the given head and body, and no error.
        Parameters:
        head - The message head.
        body - The message body.
        Since:
        5.5
      • error

        public static <H extends MessageHeaders,​B> Message<H,​B> error​(H head,
                                                                                  java.lang.Object error)
        Create a new message with the given head and error.
        Parameters:
        head - The message head.
        error - The untyped object containing error details.
        Since:
        5.5
      • head

        public H head()
        Gets the message head.
        Returns:
        the message head.
        Since:
        5.5
      • getHead

        public H getHead()
        Gets the message head.
        Returns:
        the message head.
      • body

        public B body()
        Gets the message body.
        Returns:
        the message body.
        Since:
        5.5
      • getBody

        public B getBody()
        Gets the message body.
        Returns:
        the message body.
      • error

        public java.lang.Object error()
        Since:
        5.5
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object