Class Memo

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

public class Memo extends Object implements XdrElement
Memo's original definition in the XDR file is:
 union Memo switch (MemoType type)
 {
 case MEMO_NONE:
     void;
 case MEMO_TEXT:
     string text<28>;
 case MEMO_ID:
     uint64 id;
 case MEMO_HASH:
     Hash hash; // the hash of what to pull from the content server
 case MEMO_RETURN:
     Hash retHash; // the hash of the tx you are rejecting
 };
 
  • Constructor Details

    • Memo

      public Memo()
    • Memo

      public Memo(MemoType discriminant, XdrString text, Uint64 id, Hash hash, Hash retHash)
      Creates a new Memo instance.
      Parameters:
      discriminant - the discriminant field value
      text - the text field value
      id - the id field value
      hash - the hash field value
      retHash - the retHash 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 Memo decode(XdrDataInputStream stream, int maxDepth) throws IOException
      Throws:
      IOException
    • decode

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

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

      public static Memo 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 Memo fromJson(String json)
    • builder

      public static Memo.MemoBuilder builder()
    • toBuilder

      public Memo.MemoBuilder toBuilder()
    • getDiscriminant

      public MemoType getDiscriminant()
      Value of the discriminant field.
      Returns:
      the discriminant field value
    • getText

      public XdrString getText()
      Value of the text field.
      Returns:
      the text field value
    • getId

      public Uint64 getId()
      Value of the id field.
      Returns:
      the id field value
    • getHash

      public Hash getHash()
      Value of the hash field.
      Returns:
      the hash field value
    • getRetHash

      public Hash getRetHash()
      Value of the retHash field.
      Returns:
      the retHash field value
    • setDiscriminant

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

      public void setText(XdrString text)
      Value of the text field.
      Parameters:
      text - the text field value
    • setId

      public void setId(Uint64 id)
      Value of the id field.
      Parameters:
      id - the id field value
    • setHash

      public void setHash(Hash hash)
      Value of the hash field.
      Parameters:
      hash - the hash field value
    • setRetHash

      public void setRetHash(Hash retHash)
      Value of the retHash field.
      Parameters:
      retHash - the retHash 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