public final class Price
extends java.lang.Object
Constructor and Description |
---|
Price(int numerator,
int denominator)
Creates a new
Price instance. |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object o) |
static Price |
fromString(@NonNull java.lang.String price)
Approximates
price to a fraction. |
static Price |
fromXdr(Price price)
Generates a Price SDK object from the XDR representation.
|
int |
getDenominator()
denominator
|
int |
getNumerator()
numerator
|
int |
hashCode() |
java.lang.String |
toString()
Returns price as a string.
|
Price |
toXdr()
Generates Price XDR object.
|
public Price(int numerator, int denominator)
Price
instance.numerator
- numeratordenominator
- denominatorpublic static Price fromString(@NonNull @NonNull java.lang.String price)
price
to a fraction. Please remember that this function can give
unexpected results for values that cannot be represented as a fraction with 32-bit numerator
and denominator. It's safer to create a Price object using the constructor.price
- Ex. "1.25"public static Price fromXdr(Price price)
public Price toXdr()
public java.lang.String toString()
toString
in class java.lang.Object
public int getNumerator()
public int getDenominator()
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object