Record Class Message

java.lang.Object
java.lang.Record
lol.trq.orpheus.linux.dbus.Message
Record Components:
type - CALL, RETURN, ERROR or SIGNAL
serial - the sender's serial number; assigned on sending
replySerial - the serial this message answers, or 0
path - the object path
iface - the interface
member - the method or signal name
error - the error name of an error reply
destination - the bus name the message goes to
sender - the unique bus name it came from
signature - the body signature, empty for no body
body - the body values, one per complete type

public record Message(int type, long serial, long replySerial, String path, String iface, String member, String error, String destination, String sender, String signature, List<Object> body) extends Record
One D-Bus message. Unused header fields are null.
  • Field Details

  • Constructor Details

    • Message

      public Message(int type, long serial, long replySerial, String path, String iface, String member, String error, String destination, String sender, String signature, List<Object> body)
      Creates an instance of a Message record class.
      Parameters:
      type - the value for the type record component
      serial - the value for the serial record component
      replySerial - the value for the replySerial record component
      path - the value for the path record component
      iface - the value for the iface record component
      member - the value for the member record component
      error - the value for the error record component
      destination - the value for the destination record component
      sender - the value for the sender record component
      signature - the value for the signature record component
      body - the value for the body record component
  • Method Details

    • call

      public static Message call(String destination, String path, String iface, String member, String signature, Object... body)
    • signal

      public static Message signal(String path, String iface, String member, String signature, Object... body)
    • reply

      public Message reply(String replySignature, Object... values)
    • errorReply

      public Message errorReply(String name, String text)
    • text

      public String text()
      The first body value as text, or empty. Error replies carry their explanation there.
    • encode

      public byte[] encode(long withSerial) throws WireException
      Throws:
      WireException
    • announced

      public static long announced(byte[] header) throws WireException
      The number of bytes after the fixed header, whatever its size; for skipping a message that is too large.
      Throws:
      WireException
    • remaining

      public static int remaining(byte[] header) throws WireException
      The number of bytes that follow the 16-byte fixed header.
      Throws:
      WireException
    • decode

      public static Message decode(byte[] data) throws WireException
      Decodes a complete message: the fixed header followed by everything remaining(byte[]) announced.
      Throws:
      WireException
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with the compare method from their corresponding wrapper classes.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • type

      public int type()
      Returns the value of the type record component.
      Returns:
      the value of the type record component
    • serial

      public long serial()
      Returns the value of the serial record component.
      Returns:
      the value of the serial record component
    • replySerial

      public long replySerial()
      Returns the value of the replySerial record component.
      Returns:
      the value of the replySerial record component
    • path

      public String path()
      Returns the value of the path record component.
      Returns:
      the value of the path record component
    • iface

      public String iface()
      Returns the value of the iface record component.
      Returns:
      the value of the iface record component
    • member

      public String member()
      Returns the value of the member record component.
      Returns:
      the value of the member record component
    • error

      public String error()
      Returns the value of the error record component.
      Returns:
      the value of the error record component
    • destination

      public String destination()
      Returns the value of the destination record component.
      Returns:
      the value of the destination record component
    • sender

      public String sender()
      Returns the value of the sender record component.
      Returns:
      the value of the sender record component
    • signature

      public String signature()
      Returns the value of the signature record component.
      Returns:
      the value of the signature record component
    • body

      public List<Object> body()
      Returns the value of the body record component.
      Returns:
      the value of the body record component