Class MessageCodec.NetworkMessage

java.lang.Object
com.privatechain.network.rpc.MessageCodec.NetworkMessage
Enclosing class:
MessageCodec

public static final class MessageCodec.NetworkMessage extends Object
Immutable envelope wrapping all P2P messages.

The payload field holds a raw JSON string whose schema is determined by MessageCodec.MessageType. Storing it as a pre-serialized string avoids double-encoding during envelope serialization and simplifies re-forwarding in the gossip layer.

Since:
1.0.0
  • Constructor Details

  • Method Details

    • getType

      public MessageCodec.MessageType getType()
      Returns the message type discriminator.
      Returns:
      non-null MessageCodec.MessageType
    • getSenderId

      public String getSenderId()
      Returns the node ID of the originating sender.
      Returns:
      non-null, non-blank sender ID
    • getPayload

      public String getPayload()
      Returns the raw JSON payload string.
      Returns:
      non-null JSON string
    • toString

      public String toString()
      Returns a log-safe summary of this message.
      Overrides:
      toString in class Object
      Returns:
      string representation