Interface MessageOutgoing<Self>

    • Method Summary

      All Methods Instance Methods Abstract Methods Default Methods 
      Modifier and Type Method Description
      java.util.Optional<java.lang.Object> body()
      Gets outgoing message body, if any is set.
      Self body​(byte[] byteArray)
      Sets outgoing message body, replacing any previously set such.
      default Self body​(java.lang.String string)
      Sets outgoing message body, replacing any previously set such.
      Self body​(java.nio.charset.Charset charset, java.lang.String string)
      Sets outgoing message body, replacing any previously set such.
      Self body​(java.nio.file.Path path)
      Sets outgoing message body, replacing any previously set such.
      <L extends java.util.List<? extends DtoWritable>>
      Self
      body​(DtoEncoding encoding, L data)
      Sets outgoing message body, replacing any previously set such.
      Self body​(DtoEncoding encoding, DtoWritable data)
      Sets outgoing message body, replacing any previously set such.
      default Self body​(DtoEncoding encoding, DtoWritable... data)
      Sets outgoing message body, replacing any previously set such.
      Self clearBody()
      Removes any currently set outgoing message body.
    • Method Detail

      • body

        java.util.Optional<java.lang.Object> body()
        Gets outgoing message body, if any is set.
        Returns:
        Any currently set response body.
      • body

        Self body​(byte[] byteArray)
        Sets outgoing message body, replacing any previously set such.

        The provided byte array is scheduled for transmission to the outgoing body receiver as-is. It becomes the responsibility of the caller to ensure that the message receiver knows how to interpret the body.

        Parameters:
        byteArray - Bytes to send to message receiver.
        Returns:
        This message.
      • body

        Self body​(DtoEncoding encoding,
                  DtoWritable data)
        Sets outgoing message body, replacing any previously set such.

        The provided writable data transfer object is scheduled for encoding, using the given encoding, and transmission to the message receiver. Please refer to the Javadoc for the @DtoWritableAs annotation for more information about writable data transfer objects.

        Parameters:
        encoding - Encoding to use when encoding data, or null if an attempt is to be made to resolve the encoding automatically.
        data - Data transfer object to send to message receiver.
        Returns:
        This message.
        Throws:
        java.lang.NullPointerException - If data is null.
        See Also:
        @DtoWritableAs
      • body

        default Self body​(DtoEncoding encoding,
                          DtoWritable... data)
        Sets outgoing message body, replacing any previously set such.

        The provided array of writable data transfer objects are scheduled for encoding, using the given encoding, and transmission to the message receiver. Please refer to the Javadoc for the @DtoWritableAs annotation for more information about writable data transfer objects.

        Parameters:
        encoding - Encoding to use when encoding data, or null if an attempt is to be made to resolve the encoding automatically.
        data - Data transfer objects to send to message receiver.
        Returns:
        This message.
        Throws:
        java.lang.NullPointerException - If data is null.
        See Also:
        @DtoWritableAs
      • body

        <L extends java.util.List<? extends DtoWritable>> Self body​(DtoEncoding encoding,
                                                                    L data)
        Sets outgoing message body, replacing any previously set such.

        The provided list of writable data transfer objects are scheduled for encoding, using the given encoding, and transmission to the message receiver. Please refer to the Javadoc for the @DtoWritableAs annotation for more information about writable data transfer objects.

        Parameters:
        encoding - Encoding to use when encoding data, or null if an attempt is to be made to resolve the encoding automatically.
        data - List of data transfer objects to send to message receiver.
        Returns:
        This message.
        Throws:
        java.lang.NullPointerException - If data is null.
        See Also:
        @DtoWritableAs
      • body

        Self body​(java.nio.file.Path path)
        Sets outgoing message body, replacing any previously set such.

        The contents of the file at the provided file system path are scheduled for transmission to the message receiver as-is. It becomes the responsibility of the caller to ensure that the message receiver knows how to interpret the body.

        Parameters:
        path - Path to file to send to message receiver.
        Returns:
        This message.
        Throws:
        java.lang.NullPointerException - If path is null.
      • body

        default Self body​(java.lang.String string)
        Sets outgoing message body, replacing any previously set such.

        The provided string is scheduled for transmission to the outgoing message receiver encoded using an automatically selected character set. It becomes the responsibility of the caller to ensure that the message receiver knows how to interpret the body, unless it is to be received only as an unstructured text.

        Parameters:
        string - String to send to message receiver.
        Returns:
        This message.
        Throws:
        java.lang.NullPointerException - If string is null.
      • body

        Self body​(java.nio.charset.Charset charset,
                  java.lang.String string)
        Sets outgoing message body, replacing any previously set such.

        The provided string is scheduled for transmission to the outgoing message receiver encoded using specified charset. It becomes the responsibility of the caller to ensure that the message receiver knows how to interpret the body, unless it is to be received only as an unstructured text.

        Parameters:
        charset - Character set to use for encoding string.
        string - String to send to message receiver.
        Returns:
        This message.
        Throws:
        java.lang.NullPointerException - If string is null.
      • clearBody

        Self clearBody()
        Removes any currently set outgoing message body.
        Returns:
        This message.