Class ImmutableOfferObject

java.lang.Object
org.xrpl.xrpl4j.model.ledger.ImmutableOfferObject
All Implemented Interfaces:
LedgerObject, OfferObject

@ParametersAreNonnullByDefault @Generated("org.immutables.processor.ProxyProcessor") @Immutable @CheckReturnValue public final class ImmutableOfferObject extends Object implements OfferObject
Immutable implementation of OfferObject.

Use the builder to create immutable instances: ImmutableOfferObject.builder().

  • Method Details

    • ledgerEntryType

      public LedgerObject.LedgerEntryType ledgerEntryType()
      The value 0x006F, mapped to the string "Offer", indicates that this object is a OfferObject object.
      Specified by:
      ledgerEntryType in interface OfferObject
      Returns:
      Always LedgerObject.LedgerEntryType.OFFER.
    • account

      public Address account()
      The sender of the OfferObject. Cashing the OfferObject debits this address's balance.
      Specified by:
      account in interface OfferObject
      Returns:
      The Address of the offer sender.
    • flags

      public OfferFlags flags()
      A bit-map of boolean flags.
      Specified by:
      flags in interface OfferObject
      Returns:
      A OfferFlags.
    • sequence

      public com.google.common.primitives.UnsignedInteger sequence()
      The sequence number of the OfferCreate transaction that created this offer.
      Specified by:
      sequence in interface OfferObject
      Returns:
      An UnsignedInteger representing the sequence number.
    • takerPays

      public CurrencyAmount takerPays()
      The remaining amount and type of currency requested by the offer creator.
      Specified by:
      takerPays in interface OfferObject
      Returns:
      A CurrencyAmount.
    • takerGets

      public CurrencyAmount takerGets()
      The remaining amount and type of currency being provided by the offer creator.
      Specified by:
      takerGets in interface OfferObject
      Returns:
      A CurrencyAmount.
    • bookDirectory

      public Hash256 bookDirectory()
      The ID of the Offer Directory that links to this offer.
      Specified by:
      bookDirectory in interface OfferObject
      Returns:
      A Hash256 containing the ID.
    • bookNode

      public String bookNode()
      A hint indicating which page of the offer directory links to this object, in case the directory consists of multiple pages.
      Specified by:
      bookNode in interface OfferObject
      Returns:
      A String containing the hint.
    • ownerNode

      public String ownerNode()
      A hint indicating which page of the sender's owner directory links to this object, in case the directory consists of multiple pages. Note: The object does not contain a direct link to the owner directory containing it, since that value can be derived from the Account.
      Specified by:
      ownerNode in interface OfferObject
      Returns:
      A String containing the hint.
    • previousTransactionId

      public Hash256 previousTransactionId()
      The identifying hash of the transaction that most recently modified this object.
      Specified by:
      previousTransactionId in interface OfferObject
      Returns:
      A Hash256 containing the previous transaction hash.
    • previousTransactionLedgerSequence

      public com.google.common.primitives.UnsignedInteger previousTransactionLedgerSequence()
      The index of the ledger that contains the transaction that most recently modified this object.
      Specified by:
      previousTransactionLedgerSequence in interface OfferObject
      Returns:
      An UnsignedInteger representing the previous transaction ledger sequence.
    • expiration

      public Optional<com.google.common.primitives.UnsignedInteger> expiration()
      Indicates the time after which this offer is considered expired, in seconds since the Ripple Epoch.
      Specified by:
      expiration in interface OfferObject
      Returns:
      An Optional of type UnsignedInteger representing the expiration of this offer.
    • domainId

      public Optional<Hash256> domainId()
      The permissioned domain that the offer is part of.
      Specified by:
      domainId in interface OfferObject
      Returns:
      A Hash256 representing DomainID.
    • additionalBooks

      public com.google.common.collect.ImmutableList<BookWrapper> additionalBooks()
      An additional list of order book directories that this offer belongs to. Currently, this field only applicable to hybrid offers.
      Specified by:
      additionalBooks in interface OfferObject
      Returns:
      A list of BookWrapper representing order book directories.
    • index

      public Hash256 index()
      The unique ID of the OfferObject.
      Specified by:
      index in interface OfferObject
      Returns:
      A Hash256 containing the ID.
    • withAccount

      public final ImmutableOfferObject withAccount(Address value)
      Copy the current immutable object by setting a value for the account attribute. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for account
      Returns:
      A modified copy of the this object
    • withFlags

      public final ImmutableOfferObject withFlags(OfferFlags value)
      Copy the current immutable object by setting a value for the flags attribute. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for flags
      Returns:
      A modified copy of the this object
    • withSequence

      public final ImmutableOfferObject withSequence(com.google.common.primitives.UnsignedInteger value)
      Copy the current immutable object by setting a value for the sequence attribute. An equals check used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for sequence
      Returns:
      A modified copy of the this object
    • withTakerPays

      public final ImmutableOfferObject withTakerPays(CurrencyAmount value)
      Copy the current immutable object by setting a value for the takerPays attribute. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for takerPays
      Returns:
      A modified copy of the this object
    • withTakerGets

      public final ImmutableOfferObject withTakerGets(CurrencyAmount value)
      Copy the current immutable object by setting a value for the takerGets attribute. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for takerGets
      Returns:
      A modified copy of the this object
    • withBookDirectory

      public final ImmutableOfferObject withBookDirectory(Hash256 value)
      Copy the current immutable object by setting a value for the bookDirectory attribute. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for bookDirectory
      Returns:
      A modified copy of the this object
    • withBookNode

      public final ImmutableOfferObject withBookNode(String value)
      Copy the current immutable object by setting a value for the bookNode attribute. An equals check used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for bookNode
      Returns:
      A modified copy of the this object
    • withOwnerNode

      public final ImmutableOfferObject withOwnerNode(String value)
      Copy the current immutable object by setting a value for the ownerNode attribute. An equals check used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for ownerNode
      Returns:
      A modified copy of the this object
    • withPreviousTransactionId

      public final ImmutableOfferObject withPreviousTransactionId(Hash256 value)
      Copy the current immutable object by setting a value for the previousTransactionId attribute. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for previousTransactionId
      Returns:
      A modified copy of the this object
    • withPreviousTransactionLedgerSequence

      public final ImmutableOfferObject withPreviousTransactionLedgerSequence(com.google.common.primitives.UnsignedInteger value)
      Copy the current immutable object by setting a value for the previousTransactionLedgerSequence attribute. An equals check used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for previousTransactionLedgerSequence
      Returns:
      A modified copy of the this object
    • withExpiration

      public final ImmutableOfferObject withExpiration(com.google.common.primitives.UnsignedInteger value)
      Copy the current immutable object by setting a present value for the optional expiration attribute.
      Parameters:
      value - The value for expiration
      Returns:
      A modified copy of this object
    • withExpiration

      public final ImmutableOfferObject withExpiration(Optional<? extends com.google.common.primitives.UnsignedInteger> optional)
      Copy the current immutable object by setting an optional value for the expiration attribute. An equality check is used on inner nullable value to prevent copying of the same value by returning this.
      Parameters:
      optional - A value for expiration
      Returns:
      A modified copy of this object
    • withDomainId

      public final ImmutableOfferObject withDomainId(Hash256 value)
      Copy the current immutable object by setting a present value for the optional domainId attribute.
      Parameters:
      value - The value for domainId
      Returns:
      A modified copy of this object
    • withDomainId

      public final ImmutableOfferObject withDomainId(Optional<? extends Hash256> optional)
      Copy the current immutable object by setting an optional value for the domainId attribute. A shallow reference equality check is used on unboxed optional value to prevent copying of the same value by returning this.
      Parameters:
      optional - A value for domainId
      Returns:
      A modified copy of this object
    • withAdditionalBooks

      public final ImmutableOfferObject withAdditionalBooks(BookWrapper... elements)
      Copy the current immutable object with elements that replace the content of additionalBooks.
      Parameters:
      elements - The elements to set
      Returns:
      A modified copy of this object
    • withAdditionalBooks

      public final ImmutableOfferObject withAdditionalBooks(Iterable<? extends BookWrapper> elements)
      Copy the current immutable object with elements that replace the content of additionalBooks. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      elements - An iterable of additionalBooks elements to set
      Returns:
      A modified copy of this object
    • withIndex

      public final ImmutableOfferObject withIndex(Hash256 value)
      Copy the current immutable object by setting a value for the index attribute. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for index
      Returns:
      A modified copy of the this object
    • equals

      public boolean equals(@Nullable Object another)
      This instance is equal to all instances of ImmutableOfferObject that have equal attribute values.
      Overrides:
      equals in class Object
      Returns:
      true if this is equal to another instance
    • hashCode

      public int hashCode()
      Computes a hash code from attributes: ledgerEntryType, account, flags, sequence, takerPays, takerGets, bookDirectory, bookNode, ownerNode, previousTransactionId, previousTransactionLedgerSequence, expiration, domainId, additionalBooks, index.
      Overrides:
      hashCode in class Object
      Returns:
      hashCode value
    • toString

      public String toString()
      Prints the immutable value OfferObject with attribute values.
      Overrides:
      toString in class Object
      Returns:
      A string representation of the value
    • copyOf

      public static ImmutableOfferObject copyOf(OfferObject instance)
      Creates an immutable copy of a OfferObject value. Uses accessors to get values to initialize the new immutable instance. If an instance is already immutable, it is returned as is.
      Parameters:
      instance - The instance to copy
      Returns:
      A copied immutable OfferObject instance
    • builder

      public static ImmutableOfferObject.Builder builder()
      Creates a builder for ImmutableOfferObject.
       ImmutableOfferObject.builder()
          .account(org.xrpl.xrpl4j.model.transactions.Address) // required account
          .flags(org.xrpl.xrpl4j.model.flags.OfferFlags) // required flags
          .sequence(com.google.common.primitives.UnsignedInteger) // required sequence
          .takerPays(org.xrpl.xrpl4j.model.transactions.CurrencyAmount) // required takerPays
          .takerGets(org.xrpl.xrpl4j.model.transactions.CurrencyAmount) // required takerGets
          .bookDirectory(org.xrpl.xrpl4j.model.transactions.Hash256) // required bookDirectory
          .bookNode(String) // required bookNode
          .ownerNode(String) // required ownerNode
          .previousTransactionId(org.xrpl.xrpl4j.model.transactions.Hash256) // required previousTransactionId
          .previousTransactionLedgerSequence(com.google.common.primitives.UnsignedInteger) // required previousTransactionLedgerSequence
          .expiration(com.google.common.primitives.UnsignedInteger) // optional expiration
          .domainId(org.xrpl.xrpl4j.model.transactions.Hash256) // optional domainId
          .addAdditionalBooks|addAllAdditionalBooks(org.xrpl.xrpl4j.model.ledger.BookWrapper) // additionalBooks elements
          .index(org.xrpl.xrpl4j.model.transactions.Hash256) // required index
          .build();
       
      Returns:
      A new ImmutableOfferObject builder