public final class MonetaryRoundings
extends java.lang.Object
MonetaryOperator
.
This class is thread-safe.
Modifier and Type | Method and Description |
---|---|
static MonetaryOperator |
getCashRounding(CurrencyUnit currency)
Creates an
MonetaryOperator for rounding MonetaryAmount
instances given a currency. |
static MonetaryOperator |
getCashRounding(CurrencyUnit currency,
long timestamp)
Creates an
MonetaryOperator for rounding MonetaryAmount
instances given a currency, hereby the rounding must be valid for the
given timestamp. |
static java.util.Set<java.lang.String> |
getCustomRoundingIds()
Allows to access the identifiers of the current defined custom roundings.
|
static MonetaryOperator |
getRounding()
Creates a rounding that can be added as
MonetaryOperator to
chained calculations. |
static MonetaryOperator |
getRounding(CurrencyUnit currency)
Creates an
MonetaryOperator for rounding MonetaryAmount
instances given a currency. |
static MonetaryOperator |
getRounding(CurrencyUnit currency,
long timestamp)
Creates an
MonetaryOperator for rounding MonetaryAmount
instances given a currency, hereby the rounding must be valid for the
given timestamp. |
static MonetaryOperator |
getRounding(MonetaryContext monetaryContext)
Creates an rounding instance using
java.math.RoundingMode#UP rounding. |
static MonetaryOperator |
getRounding(java.lang.String customRoundingId)
Access an
MonetaryOperator for custom rounding
MonetaryAmount instances. |
public static MonetaryOperator getCashRounding(CurrencyUnit currency)
MonetaryOperator
for rounding MonetaryAmount
instances given a currency.currency
- The currency, which determines the required precision. As
java.math.RoundingMode
, by default, java.math.RoundingMode#HALF_UP
is sued.MonetaryOperator
implementing the
rounding, never null
.public static MonetaryOperator getCashRounding(CurrencyUnit currency, long timestamp)
MonetaryOperator
for rounding MonetaryAmount
instances given a currency, hereby the rounding must be valid for the
given timestamp.currency
- The currency, which determines the required precision. As
java.math.RoundingMode
, by default, java.math.RoundingMode#HALF_UP
is sued.timestamp
- the UTC timestamp.MonetaryOperator
implementing the
rounding, or null
.public static java.util.Set<java.lang.String> getCustomRoundingIds()
null
.public static MonetaryOperator getRounding()
MonetaryOperator
to
chained calculations. The instance will lookup the concrete
MonetaryOperator
instance from the MonetaryRoundings
based on the input MonetaryAmount
's CurrencyUnit
.public static MonetaryOperator getRounding(CurrencyUnit currency)
MonetaryOperator
for rounding MonetaryAmount
instances given a currency.currency
- The currency, which determines the required precision. As
java.math.RoundingMode
, by default, java.math.RoundingMode#HALF_UP
is sued.MonetaryOperator
implementing the
rounding, never null
.public static MonetaryOperator getRounding(CurrencyUnit currency, long timestamp)
MonetaryOperator
for rounding MonetaryAmount
instances given a currency, hereby the rounding must be valid for the
given timestamp.currency
- The currency, which determines the required precision. As
java.math.RoundingMode
, by default, java.math.RoundingMode#HALF_UP
is used.timestamp
- the UTC timestamp.MonetaryOperator
implementing the
rounding, or null
.public static MonetaryOperator getRounding(MonetaryContext monetaryContext)
java.math.RoundingMode#UP
rounding.monetaryContext
- The MonetaryContext
defining the required rounding.MonetaryOperator
implementing the
rounding.MonetaryException
- if no such rounding could be evaluated.public static MonetaryOperator getRounding(java.lang.String customRoundingId)
MonetaryOperator
for custom rounding
MonetaryAmount
instances.customRoundingId
- The customRounding identifier.MonetaryOperator
implementing the
rounding, never null
.java.lang.IllegalArgumentException
- if no such rounding is registered using a
RoundingProviderSpi
instance.