Class ImmutablePriceData
java.lang.Object
org.xrpl.xrpl4j.model.transactions.ImmutablePriceData
- All Implemented Interfaces:
PriceData
@ParametersAreNonnullByDefault
@Generated("org.immutables.processor.ProxyProcessor")
@Immutable
@CheckReturnValue
public final class ImmutablePriceData
extends Object
implements PriceData
Immutable implementation of
PriceData.
Use the builder to create immutable instances:
ImmutablePriceData.builder().
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionThe asset price after applying thescale()precision level.The primary asset in a trading pair.static ImmutablePriceData.Builderbuilder()Creates a builder forImmutablePriceData.static ImmutablePriceDataCreates an immutable copy of aPriceDatavalue.booleanThis instance is equal to all instances ofImmutablePriceDatathat have equal attribute values.inthashCode()Computes a hash code from attributes:baseAsset,quoteAsset,assetPrice,scale.The quote asset in a trading pair.Optional<com.google.common.primitives.UnsignedInteger> scale()The scaling factor to apply to an asset price.toString()Prints the immutable valuePriceDatawith attribute values.final ImmutablePriceDatawithAssetPrice(Optional<? extends AssetPrice> optional) Copy the current immutable object by setting an optional value for theassetPriceattribute.final ImmutablePriceDatawithAssetPrice(AssetPrice value) Copy the current immutable object by setting a present value for the optionalassetPriceattribute.final ImmutablePriceDatawithBaseAsset(String value) Copy the current immutable object by setting a value for thebaseAssetattribute.final ImmutablePriceDatawithQuoteAsset(String value) Copy the current immutable object by setting a value for thequoteAssetattribute.final ImmutablePriceDatawithScale(com.google.common.primitives.UnsignedInteger value) Copy the current immutable object by setting a present value for the optionalscaleattribute.final ImmutablePriceDataCopy the current immutable object by setting an optional value for thescaleattribute.
-
Method Details
-
baseAsset
The primary asset in a trading pair. Any valid identifier, such as a stock symbol, bond CUSIP, or currency code is allowed. For example, in the BTC/USD pair, BTC is the base asset; in 912810RR9/BTC, 912810RR9 is the base asset. -
quoteAsset
The quote asset in a trading pair. The quote asset denotes the price of one unit of the base asset. For example, in the BTC/USD pair, BTC is the base asset; in 912810RR9/BTC, 912810RR9 is the base asset.- Specified by:
quoteAssetin interfacePriceData- Returns:
- A
String.
-
assetPrice
The asset price after applying thescale()precision level. It's not included if the last update transaction didn't include thebaseAsset()/quoteAsset()pair.- Specified by:
assetPricein interfacePriceData- Returns:
- An
OptionalAssetPrice.
-
scale
The scaling factor to apply to an asset price. For example, if scale is 6 and original price is 0.155, then the scaled price is 155000. Valid scale ranges are 0-10. It's not included if the last update transaction didn't include thebaseAsset()/quoteAsset()pair. -
withBaseAsset
Copy the current immutable object by setting a value for thebaseAssetattribute. An equals check used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for baseAsset- Returns:
- A modified copy of the
thisobject
-
withQuoteAsset
Copy the current immutable object by setting a value for thequoteAssetattribute. An equals check used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for quoteAsset- Returns:
- A modified copy of the
thisobject
-
withAssetPrice
Copy the current immutable object by setting a present value for the optionalassetPriceattribute.- Parameters:
value- The value for assetPrice- Returns:
- A modified copy of
thisobject
-
withAssetPrice
Copy the current immutable object by setting an optional value for theassetPriceattribute. A shallow reference equality check is used on unboxed optional value to prevent copying of the same value by returningthis.- Parameters:
optional- A value for assetPrice- Returns:
- A modified copy of
thisobject
-
withScale
Copy the current immutable object by setting a present value for the optionalscaleattribute.- Parameters:
value- The value for scale- Returns:
- A modified copy of
thisobject
-
withScale
public final ImmutablePriceData withScale(Optional<? extends com.google.common.primitives.UnsignedInteger> optional) Copy the current immutable object by setting an optional value for thescaleattribute. An equality check is used on inner nullable value to prevent copying of the same value by returningthis.- Parameters:
optional- A value for scale- Returns:
- A modified copy of
thisobject
-
equals
This instance is equal to all instances ofImmutablePriceDatathat have equal attribute values. -
hashCode
public int hashCode()Computes a hash code from attributes:baseAsset,quoteAsset,assetPrice,scale. -
toString
Prints the immutable valuePriceDatawith attribute values. -
copyOf
Creates an immutable copy of aPriceDatavalue. 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 PriceData instance
-
builder
Creates a builder forImmutablePriceData.ImmutablePriceData.builder() .baseAsset(String) // requiredbaseAsset.quoteAsset(String) // requiredquoteAsset.assetPrice(AssetPrice) // optionalassetPrice.scale(com.google.common.primitives.UnsignedInteger) // optionalscale.build();- Returns:
- A new ImmutablePriceData builder
-