Class OfferEntry

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

public class OfferEntry extends Object implements XdrElement
OfferEntry's original definition in the XDR file is:
 struct OfferEntry
 {
     AccountID sellerID;
     int64 offerID;
     Asset selling; // A
     Asset buying;  // B
     int64 amount;  // amount of A

     /* price for this offer:
         price of A in terms of B
         price=AmountB/AmountA=priceNumerator/priceDenominator
         price is after fees
     */
     Price price;
     uint32 flags; // see OfferEntryFlags

     // reserved for future use
     union switch (int v)
     {
     case 0:
         void;
     }
     ext;
 };
 
  • Constructor Details

    • OfferEntry

      public OfferEntry()
    • OfferEntry

      public OfferEntry(AccountID sellerID, Int64 offerID, Asset selling, Asset buying, Int64 amount, Price price, Uint32 flags, OfferEntry.OfferEntryExt ext)
      Creates a new OfferEntry instance.
      Parameters:
      sellerID - the sellerID field value
      offerID - the offerID field value
      selling - the selling field value
      buying - the buying field value
      amount - the amount field value
      price - the price field value
      flags - the flags field value
      ext - the ext 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 OfferEntry decode(XdrDataInputStream stream, int maxDepth) throws IOException
      Throws:
      IOException
    • decode

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

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

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

      public static OfferEntry.OfferEntryBuilder builder()
    • toBuilder

      public OfferEntry.OfferEntryBuilder toBuilder()
    • getSellerID

      public AccountID getSellerID()
      Value of the sellerID field.
      Returns:
      the sellerID field value
    • getOfferID

      public Int64 getOfferID()
      Value of the offerID field.
      Returns:
      the offerID field value
    • getSelling

      public Asset getSelling()
      Value of the selling field.
      Returns:
      the selling field value
    • getBuying

      public Asset getBuying()
      Value of the buying field.
      Returns:
      the buying field value
    • getAmount

      public Int64 getAmount()
      Value of the amount field.
      Returns:
      the amount field value
    • getPrice

      public Price getPrice()
      Value of the price field.
      Returns:
      the price field value
    • getFlags

      public Uint32 getFlags()
      Value of the flags field.
      Returns:
      the flags field value
    • getExt

      public OfferEntry.OfferEntryExt getExt()
      Value of the ext field.
      Returns:
      the ext field value
    • setSellerID

      public void setSellerID(AccountID sellerID)
      Value of the sellerID field.
      Parameters:
      sellerID - the sellerID field value
    • setOfferID

      public void setOfferID(Int64 offerID)
      Value of the offerID field.
      Parameters:
      offerID - the offerID field value
    • setSelling

      public void setSelling(Asset selling)
      Value of the selling field.
      Parameters:
      selling - the selling field value
    • setBuying

      public void setBuying(Asset buying)
      Value of the buying field.
      Parameters:
      buying - the buying field value
    • setAmount

      public void setAmount(Int64 amount)
      Value of the amount field.
      Parameters:
      amount - the amount field value
    • setPrice

      public void setPrice(Price price)
      Value of the price field.
      Parameters:
      price - the price field value
    • setFlags

      public void setFlags(Uint32 flags)
      Value of the flags field.
      Parameters:
      flags - the flags field value
    • setExt

      public void setExt(OfferEntry.OfferEntryExt ext)
      Value of the ext field.
      Parameters:
      ext - the ext 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