Class StellarMessage

java.lang.Object
org.stellar.sdk.xdr.StellarMessage
All Implemented Interfaces:
XdrElement

public class StellarMessage extends Object implements XdrElement
StellarMessage's original definition in the XDR file is:
 union StellarMessage switch (MessageType type)
 {
 case ERROR_MSG:
     Error error;
 case HELLO:
     Hello hello;
 case AUTH:
     Auth auth;
 case DONT_HAVE:
     DontHave dontHave;
 case PEERS:
     PeerAddress peers<100>;

 case GET_TX_SET:
     uint256 txSetHash;
 case TX_SET:
     TransactionSet txSet;
 case GENERALIZED_TX_SET:
     GeneralizedTransactionSet generalizedTxSet;

 case TRANSACTION:
     TransactionEnvelope transaction;

 case TIME_SLICED_SURVEY_REQUEST:
     SignedTimeSlicedSurveyRequestMessage signedTimeSlicedSurveyRequestMessage;

 case TIME_SLICED_SURVEY_RESPONSE:
     SignedTimeSlicedSurveyResponseMessage signedTimeSlicedSurveyResponseMessage;

 case TIME_SLICED_SURVEY_START_COLLECTING:
     SignedTimeSlicedSurveyStartCollectingMessage
         signedTimeSlicedSurveyStartCollectingMessage;

 case TIME_SLICED_SURVEY_STOP_COLLECTING:
     SignedTimeSlicedSurveyStopCollectingMessage
         signedTimeSlicedSurveyStopCollectingMessage;

 // SCP
 case GET_SCP_QUORUMSET:
     uint256 qSetHash;
 case SCP_QUORUMSET:
     SCPQuorumSet qSet;
 case SCP_MESSAGE:
     SCPEnvelope envelope;
 case GET_SCP_STATE:
     uint32 getSCPLedgerSeq; // ledger seq requested ; if 0, requests the latest
 case SEND_MORE:
     SendMore sendMoreMessage;
 case SEND_MORE_EXTENDED:
     SendMoreExtended sendMoreExtendedMessage;
 // Pull mode
 case FLOOD_ADVERT:
      FloodAdvert floodAdvert;
 case FLOOD_DEMAND:
      FloodDemand floodDemand;
 };
 
  • Constructor Details

    • StellarMessage

      public StellarMessage()
    • StellarMessage

      public StellarMessage(MessageType discriminant, Error error, Hello hello, Auth auth, DontHave dontHave, PeerAddress[] peers, Uint256 txSetHash, TransactionSet txSet, GeneralizedTransactionSet generalizedTxSet, TransactionEnvelope transaction, SignedTimeSlicedSurveyRequestMessage signedTimeSlicedSurveyRequestMessage, SignedTimeSlicedSurveyResponseMessage signedTimeSlicedSurveyResponseMessage, SignedTimeSlicedSurveyStartCollectingMessage signedTimeSlicedSurveyStartCollectingMessage, SignedTimeSlicedSurveyStopCollectingMessage signedTimeSlicedSurveyStopCollectingMessage, Uint256 qSetHash, SCPQuorumSet qSet, SCPEnvelope envelope, Uint32 getSCPLedgerSeq, SendMore sendMoreMessage, SendMoreExtended sendMoreExtendedMessage, FloodAdvert floodAdvert, FloodDemand floodDemand)
      Creates a new StellarMessage instance.
      Parameters:
      discriminant - the discriminant field value
      error - the error field value
      hello - the hello field value
      auth - the auth field value
      dontHave - the dontHave field value
      peers - the peers field value
      txSetHash - the txSetHash field value
      txSet - the txSet field value
      generalizedTxSet - the generalizedTxSet field value
      transaction - the transaction field value
      signedTimeSlicedSurveyRequestMessage - the signedTimeSlicedSurveyRequestMessage field value
      signedTimeSlicedSurveyResponseMessage - the signedTimeSlicedSurveyResponseMessage field value
      signedTimeSlicedSurveyStartCollectingMessage - the signedTimeSlicedSurveyStartCollectingMessage field value
      signedTimeSlicedSurveyStopCollectingMessage - the signedTimeSlicedSurveyStopCollectingMessage field value
      qSetHash - the qSetHash field value
      qSet - the qSet field value
      envelope - the envelope field value
      getSCPLedgerSeq - the getSCPLedgerSeq field value
      sendMoreMessage - the sendMoreMessage field value
      sendMoreExtendedMessage - the sendMoreExtendedMessage field value
      floodAdvert - the floodAdvert field value
      floodDemand - the floodDemand field value
  • Method Details

    • encode

      public void encode(XdrDataOutputStream stream) throws IOException
      Description copied from interface: XdrElement
      Encodes this value to XDR and writes it to the provided stream.
      Specified by:
      encode in interface XdrElement
      Parameters:
      stream - the destination XDR output stream
      Throws:
      IOException - if an I/O error occurs while writing the value
    • decode

      public static StellarMessage decode(XdrDataInputStream stream, int maxDepth) throws IOException
      Throws:
      IOException
    • decode

      public static StellarMessage decode(XdrDataInputStream stream) throws IOException
      Throws:
      IOException
    • fromXdrBase64

      public static StellarMessage fromXdrBase64(String xdr) throws IOException
      Throws:
      IOException
    • fromXdrByteArray

      public static StellarMessage fromXdrByteArray(byte[] xdr) throws IOException
      Throws:
      IOException
    • toJson

      public String toJson()
      Description copied from interface: XdrElement
      Serializes this value to JSON.
      Specified by:
      toJson in interface XdrElement
      Returns:
      the JSON representation of this value
    • fromJson

      public static StellarMessage fromJson(String json)
    • builder

      public static StellarMessage.StellarMessageBuilder builder()
    • toBuilder

    • getDiscriminant

      public MessageType getDiscriminant()
      Value of the discriminant field.
      Returns:
      the discriminant field value
    • getError

      public Error getError()
      Value of the error field.
      Returns:
      the error field value
    • getHello

      public Hello getHello()
      Value of the hello field.
      Returns:
      the hello field value
    • getAuth

      public Auth getAuth()
      Value of the auth field.
      Returns:
      the auth field value
    • getDontHave

      public DontHave getDontHave()
      Value of the dontHave field.
      Returns:
      the dontHave field value
    • getPeers

      public PeerAddress[] getPeers()
      Value of the peers field.
      Returns:
      the peers field value
    • getTxSetHash

      public Uint256 getTxSetHash()
      Value of the txSetHash field.
      Returns:
      the txSetHash field value
    • getTxSet

      public TransactionSet getTxSet()
      Value of the txSet field.
      Returns:
      the txSet field value
    • getGeneralizedTxSet

      public GeneralizedTransactionSet getGeneralizedTxSet()
      Value of the generalizedTxSet field.
      Returns:
      the generalizedTxSet field value
    • getTransaction

      public TransactionEnvelope getTransaction()
      Value of the transaction field.
      Returns:
      the transaction field value
    • getSignedTimeSlicedSurveyRequestMessage

      public SignedTimeSlicedSurveyRequestMessage getSignedTimeSlicedSurveyRequestMessage()
      Value of the signedTimeSlicedSurveyRequestMessage field.
      Returns:
      the signedTimeSlicedSurveyRequestMessage field value
    • getSignedTimeSlicedSurveyResponseMessage

      public SignedTimeSlicedSurveyResponseMessage getSignedTimeSlicedSurveyResponseMessage()
      Value of the signedTimeSlicedSurveyResponseMessage field.
      Returns:
      the signedTimeSlicedSurveyResponseMessage field value
    • getSignedTimeSlicedSurveyStartCollectingMessage

      public SignedTimeSlicedSurveyStartCollectingMessage getSignedTimeSlicedSurveyStartCollectingMessage()
      Value of the signedTimeSlicedSurveyStartCollectingMessage field.
      Returns:
      the signedTimeSlicedSurveyStartCollectingMessage field value
    • getSignedTimeSlicedSurveyStopCollectingMessage

      public SignedTimeSlicedSurveyStopCollectingMessage getSignedTimeSlicedSurveyStopCollectingMessage()
      Value of the signedTimeSlicedSurveyStopCollectingMessage field.
      Returns:
      the signedTimeSlicedSurveyStopCollectingMessage field value
    • getQSetHash

      public Uint256 getQSetHash()
      Value of the qSetHash field.
      Returns:
      the qSetHash field value
    • getQSet

      public SCPQuorumSet getQSet()
      Value of the qSet field.
      Returns:
      the qSet field value
    • getEnvelope

      public SCPEnvelope getEnvelope()
      Value of the envelope field.
      Returns:
      the envelope field value
    • getGetSCPLedgerSeq

      public Uint32 getGetSCPLedgerSeq()
      Value of the getSCPLedgerSeq field.
      Returns:
      the getSCPLedgerSeq field value
    • getSendMoreMessage

      public SendMore getSendMoreMessage()
      Value of the sendMoreMessage field.
      Returns:
      the sendMoreMessage field value
    • getSendMoreExtendedMessage

      public SendMoreExtended getSendMoreExtendedMessage()
      Value of the sendMoreExtendedMessage field.
      Returns:
      the sendMoreExtendedMessage field value
    • getFloodAdvert

      public FloodAdvert getFloodAdvert()
      Value of the floodAdvert field.
      Returns:
      the floodAdvert field value
    • getFloodDemand

      public FloodDemand getFloodDemand()
      Value of the floodDemand field.
      Returns:
      the floodDemand field value
    • setDiscriminant

      public void setDiscriminant(MessageType discriminant)
      Value of the discriminant field.
      Parameters:
      discriminant - the discriminant field value
    • setError

      public void setError(Error error)
      Value of the error field.
      Parameters:
      error - the error field value
    • setHello

      public void setHello(Hello hello)
      Value of the hello field.
      Parameters:
      hello - the hello field value
    • setAuth

      public void setAuth(Auth auth)
      Value of the auth field.
      Parameters:
      auth - the auth field value
    • setDontHave

      public void setDontHave(DontHave dontHave)
      Value of the dontHave field.
      Parameters:
      dontHave - the dontHave field value
    • setPeers

      public void setPeers(PeerAddress[] peers)
      Value of the peers field.
      Parameters:
      peers - the peers field value
    • setTxSetHash

      public void setTxSetHash(Uint256 txSetHash)
      Value of the txSetHash field.
      Parameters:
      txSetHash - the txSetHash field value
    • setTxSet

      public void setTxSet(TransactionSet txSet)
      Value of the txSet field.
      Parameters:
      txSet - the txSet field value
    • setGeneralizedTxSet

      public void setGeneralizedTxSet(GeneralizedTransactionSet generalizedTxSet)
      Value of the generalizedTxSet field.
      Parameters:
      generalizedTxSet - the generalizedTxSet field value
    • setTransaction

      public void setTransaction(TransactionEnvelope transaction)
      Value of the transaction field.
      Parameters:
      transaction - the transaction field value
    • setSignedTimeSlicedSurveyRequestMessage

      public void setSignedTimeSlicedSurveyRequestMessage(SignedTimeSlicedSurveyRequestMessage signedTimeSlicedSurveyRequestMessage)
      Value of the signedTimeSlicedSurveyRequestMessage field.
      Parameters:
      signedTimeSlicedSurveyRequestMessage - the signedTimeSlicedSurveyRequestMessage field value
    • setSignedTimeSlicedSurveyResponseMessage

      public void setSignedTimeSlicedSurveyResponseMessage(SignedTimeSlicedSurveyResponseMessage signedTimeSlicedSurveyResponseMessage)
      Value of the signedTimeSlicedSurveyResponseMessage field.
      Parameters:
      signedTimeSlicedSurveyResponseMessage - the signedTimeSlicedSurveyResponseMessage field value
    • setSignedTimeSlicedSurveyStartCollectingMessage

      public void setSignedTimeSlicedSurveyStartCollectingMessage(SignedTimeSlicedSurveyStartCollectingMessage signedTimeSlicedSurveyStartCollectingMessage)
      Value of the signedTimeSlicedSurveyStartCollectingMessage field.
      Parameters:
      signedTimeSlicedSurveyStartCollectingMessage - the signedTimeSlicedSurveyStartCollectingMessage field value
    • setSignedTimeSlicedSurveyStopCollectingMessage

      public void setSignedTimeSlicedSurveyStopCollectingMessage(SignedTimeSlicedSurveyStopCollectingMessage signedTimeSlicedSurveyStopCollectingMessage)
      Value of the signedTimeSlicedSurveyStopCollectingMessage field.
      Parameters:
      signedTimeSlicedSurveyStopCollectingMessage - the signedTimeSlicedSurveyStopCollectingMessage field value
    • setQSetHash

      public void setQSetHash(Uint256 qSetHash)
      Value of the qSetHash field.
      Parameters:
      qSetHash - the qSetHash field value
    • setQSet

      public void setQSet(SCPQuorumSet qSet)
      Value of the qSet field.
      Parameters:
      qSet - the qSet field value
    • setEnvelope

      public void setEnvelope(SCPEnvelope envelope)
      Value of the envelope field.
      Parameters:
      envelope - the envelope field value
    • setGetSCPLedgerSeq

      public void setGetSCPLedgerSeq(Uint32 getSCPLedgerSeq)
      Value of the getSCPLedgerSeq field.
      Parameters:
      getSCPLedgerSeq - the getSCPLedgerSeq field value
    • setSendMoreMessage

      public void setSendMoreMessage(SendMore sendMoreMessage)
      Value of the sendMoreMessage field.
      Parameters:
      sendMoreMessage - the sendMoreMessage field value
    • setSendMoreExtendedMessage

      public void setSendMoreExtendedMessage(SendMoreExtended sendMoreExtendedMessage)
      Value of the sendMoreExtendedMessage field.
      Parameters:
      sendMoreExtendedMessage - the sendMoreExtendedMessage field value
    • setFloodAdvert

      public void setFloodAdvert(FloodAdvert floodAdvert)
      Value of the floodAdvert field.
      Parameters:
      floodAdvert - the floodAdvert field value
    • setFloodDemand

      public void setFloodDemand(FloodDemand floodDemand)
      Value of the floodDemand field.
      Parameters:
      floodDemand - the floodDemand field value
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object