Class ImmutableGetAggregatePriceResult

java.lang.Object
org.xrpl.xrpl4j.model.client.oracle.ImmutableGetAggregatePriceResult
All Implemented Interfaces:
GetAggregatePriceResult, XrplResult

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

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

  • Method Details

    • status

      public Optional<String> status()
      The value "success" indicates the request was successfully received and understood by the server.
      Specified by:
      status in interface XrplResult
      Returns:
      The String "success" if the request was successful, otherwise Optional.empty().
    • entireSet

      public AggregatePriceSet entireSet()
      The statistics from the collected oracle prices.
      Specified by:
      entireSet in interface GetAggregatePriceResult
      Returns:
      An AggregatePriceSet.
    • trimmedSet

      public Optional<AggregatePriceSet> trimmedSet()
      The trimmed statistics from the collected oracle prices. Only appears if the trim field was specified in the request.
      Specified by:
      trimmedSet in interface GetAggregatePriceResult
      Returns:
      An Optional AggregatePriceSet.
    • medianString

      public String medianString()
      The median price, as a String.
      Specified by:
      medianString in interface GetAggregatePriceResult
      Returns:
      A String.
    • time

      public com.google.common.primitives.UnsignedInteger time()
      The most recent timestamp out of all LastUpdateTime values.
      Specified by:
      time in interface GetAggregatePriceResult
      Returns:
      An UnsignedInteger.
    • ledgerHash

      public Optional<Hash256> ledgerHash()
      The identifying Hash of the ledger version used to generate this response.
      Specified by:
      ledgerHash in interface GetAggregatePriceResult
      Returns:
      A Hash256 containing the ledger hash.
    • ledgerIndex

      public Optional<LedgerIndex> ledgerIndex()
      The Ledger Index of the ledger version used to generate this response. Only present in responses to requests with ledger_index = "validated" or "closed".
      Specified by:
      ledgerIndex in interface GetAggregatePriceResult
      Returns:
      A LedgerIndex.
    • ledgerCurrentIndex

      public Optional<LedgerIndex> ledgerCurrentIndex()
      The ledger index of the current open ledger, which was used when retrieving this information. Only present in responses to requests with ledger_index = "current".
      Specified by:
      ledgerCurrentIndex in interface GetAggregatePriceResult
      Returns:
      An optionally-present LedgerIndex representing the current ledger index.
    • validated

      public boolean validated()
      If true, the information in this response comes from a validated ledger version. Otherwise, the information is subject to change.
      Specified by:
      validated in interface GetAggregatePriceResult
      Returns:
      true if the information in this response comes from a validated ledger version, false if not.
    • withStatus

      public final ImmutableGetAggregatePriceResult withStatus(String value)
      Copy the current immutable object by setting a present value for the optional status attribute.
      Parameters:
      value - The value for status
      Returns:
      A modified copy of this object
    • withStatus

      public final ImmutableGetAggregatePriceResult withStatus(Optional<String> optional)
      Copy the current immutable object by setting an optional value for the status 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 status
      Returns:
      A modified copy of this object
    • withEntireSet

      public final ImmutableGetAggregatePriceResult withEntireSet(AggregatePriceSet value)
      Copy the current immutable object by setting a value for the entireSet attribute. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for entireSet
      Returns:
      A modified copy of the this object
    • withTrimmedSet

      public final ImmutableGetAggregatePriceResult withTrimmedSet(AggregatePriceSet value)
      Copy the current immutable object by setting a present value for the optional trimmedSet attribute.
      Parameters:
      value - The value for trimmedSet
      Returns:
      A modified copy of this object
    • withTrimmedSet

      public final ImmutableGetAggregatePriceResult withTrimmedSet(Optional<? extends AggregatePriceSet> optional)
      Copy the current immutable object by setting an optional value for the trimmedSet 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 trimmedSet
      Returns:
      A modified copy of this object
    • withMedianString

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

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

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

      public final ImmutableGetAggregatePriceResult withLedgerHash(Optional<? extends Hash256> optional)
      Copy the current immutable object by setting an optional value for the ledgerHash 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 ledgerHash
      Returns:
      A modified copy of this object
    • withLedgerIndex

      public final ImmutableGetAggregatePriceResult withLedgerIndex(LedgerIndex value)
      Copy the current immutable object by setting a present value for the optional ledgerIndex attribute.
      Parameters:
      value - The value for ledgerIndex
      Returns:
      A modified copy of this object
    • withLedgerIndex

      public final ImmutableGetAggregatePriceResult withLedgerIndex(Optional<? extends LedgerIndex> optional)
      Copy the current immutable object by setting an optional value for the ledgerIndex 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 ledgerIndex
      Returns:
      A modified copy of this object
    • withLedgerCurrentIndex

      public final ImmutableGetAggregatePriceResult withLedgerCurrentIndex(LedgerIndex value)
      Copy the current immutable object by setting a present value for the optional ledgerCurrentIndex attribute.
      Parameters:
      value - The value for ledgerCurrentIndex
      Returns:
      A modified copy of this object
    • withLedgerCurrentIndex

      public final ImmutableGetAggregatePriceResult withLedgerCurrentIndex(Optional<? extends LedgerIndex> optional)
      Copy the current immutable object by setting an optional value for the ledgerCurrentIndex 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 ledgerCurrentIndex
      Returns:
      A modified copy of this object
    • withValidated

      public final ImmutableGetAggregatePriceResult withValidated(boolean value)
      Copy the current immutable object by setting a value for the validated attribute. A value equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for validated
      Returns:
      A modified copy of the this object
    • equals

      public boolean equals(@Nullable Object another)
      This instance is equal to all instances of ImmutableGetAggregatePriceResult 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: status, entireSet, trimmedSet, medianString, time, ledgerHash, ledgerIndex, ledgerCurrentIndex, validated.
      Overrides:
      hashCode in class Object
      Returns:
      hashCode value
    • toString

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

      public BigDecimal median()
      Get the median price as a BigDecimal.

      Returns a lazily initialized value of the median attribute. Initialized once and only once and stored for subsequent access with proper synchronization. In case of any exception or error thrown by the lazy value initializer, the result will not be memoised (i.e. remembered) and on next call computation will be attempted again.

      Specified by:
      median in interface GetAggregatePriceResult
      Returns:
      A lazily initialized value of the median attribute
    • copyOf

      Creates an immutable copy of a GetAggregatePriceResult 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 GetAggregatePriceResult instance
    • builder

      Creates a builder for ImmutableGetAggregatePriceResult.
       ImmutableGetAggregatePriceResult.builder()
          .status(String) // optional status
          .entireSet(org.xrpl.xrpl4j.model.client.oracle.AggregatePriceSet) // required entireSet
          .trimmedSet(org.xrpl.xrpl4j.model.client.oracle.AggregatePriceSet) // optional trimmedSet
          .medianString(String) // required medianString
          .time(com.google.common.primitives.UnsignedInteger) // required time
          .ledgerHash(org.xrpl.xrpl4j.model.transactions.Hash256) // optional ledgerHash
          .ledgerIndex(org.xrpl.xrpl4j.model.client.common.LedgerIndex) // optional ledgerIndex
          .ledgerCurrentIndex(org.xrpl.xrpl4j.model.client.common.LedgerIndex) // optional ledgerCurrentIndex
          .validated(boolean) // optional validated
          .build();
       
      Returns:
      A new ImmutableGetAggregatePriceResult builder