Interface CurrencyAmount
- All Known Subinterfaces:
IssuedCurrencyAmount,MptCurrencyAmount
- All Known Implementing Classes:
ImmutableIssuedCurrencyAmount,ImmutableMptCurrencyAmount,XrpCurrencyAmount
public interface CurrencyAmount
Marker interface for XRPL Currency Amounts.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final longstatic final BigDecimalstatic final longstatic final long -
Method Summary
Modifier and TypeMethodDescriptiondefault voidhandle(Consumer<XrpCurrencyAmount> xrpCurrencyAmountHandler, Consumer<IssuedCurrencyAmount> issuedCurrencyAmountConsumer, Consumer<MptCurrencyAmount> mptCurrencyAmountConsumer) Handle thisCurrencyAmountdepending on its actual polymorphic subtype.booleanIndicates whether this amount is positive or negative.default <R> Rmap(Function<XrpCurrencyAmount, R> xrpCurrencyAmountMapper, Function<IssuedCurrencyAmount, R> issuedCurrencyAmountMapper, Function<MptCurrencyAmount, R> mptCurrencyAmountMapper) Map thisCurrencyAmountto an instance ofCurrencyAmount, depending on its actual polymorphic subtype.
-
Field Details
-
ONE_XRP_IN_DROPS
static final long ONE_XRP_IN_DROPS- See Also:
-
MAX_XRP
static final long MAX_XRP- See Also:
-
MAX_XRP_IN_DROPS
static final long MAX_XRP_IN_DROPS- See Also:
-
MAX_XRP_BD
-
-
Method Details
-
isNegative
boolean isNegative()Indicates whether this amount is positive or negative.- Returns:
trueif this amount is negative;falseotherwise (i.e., if the value is 0 or positive).
-
handle
default void handle(Consumer<XrpCurrencyAmount> xrpCurrencyAmountHandler, Consumer<IssuedCurrencyAmount> issuedCurrencyAmountConsumer, Consumer<MptCurrencyAmount> mptCurrencyAmountConsumer) Handle thisCurrencyAmountdepending on its actual polymorphic subtype.- Parameters:
xrpCurrencyAmountHandler- AConsumerthat is called if this instance is of typeXrpCurrencyAmount.issuedCurrencyAmountConsumer- AConsumerthat is called if this instance is of typeIssuedCurrencyAmount.mptCurrencyAmountConsumer- AConsumerthat is called if this instance is of typeMptCurrencyAmount.
-
map
default <R> R map(Function<XrpCurrencyAmount, R> xrpCurrencyAmountMapper, Function<IssuedCurrencyAmount, R> issuedCurrencyAmountMapper, Function<MptCurrencyAmount, R> mptCurrencyAmountMapper) Map thisCurrencyAmountto an instance ofCurrencyAmount, depending on its actual polymorphic subtype.- Type Parameters:
R- The type of object to return after mapping.- Parameters:
xrpCurrencyAmountMapper- AFunctionthat is called if this instance is of typeXrpCurrencyAmount.issuedCurrencyAmountMapper- AFunctionthat is called if this instance is of typeIssuedCurrencyAmount.- Returns:
- A
CurrencyAmountthat is constructed by the appropriate mapper function.
-