public final class MonetaryRoundings extends Object
MonetaryAdjuster
.
This class is thread-safe.
Modifier and Type | Method and Description |
---|---|
static javax.money.MonetaryAdjuster |
getCashRounding(javax.money.CurrencyUnit currency)
Creates an
MonetaryAdjuster for rounding MonetaryAmount
instances given a currency. |
static javax.money.MonetaryAdjuster |
getCashRounding(javax.money.CurrencyUnit currency,
long timestamp)
Creates an
MonetaryAdjuster for rounding MonetaryAmount
instances given a currency, hereby the rounding must be valid for the
given timestamp. |
static Set<String> |
getCustomRoundingIds()
Allows to access the identifiers of the current defined custom roundings.
|
static javax.money.MonetaryAdjuster |
getRounding()
Creates a rounding that can be added as
MonetaryAdjuster to
chained calculations. |
static javax.money.MonetaryAdjuster |
getRounding(javax.money.CurrencyUnit currency)
Creates an
MonetaryAdjuster for rounding MonetaryAmount
instances given a currency. |
static javax.money.MonetaryAdjuster |
getRounding(javax.money.CurrencyUnit currency,
long timestamp)
Creates an
MonetaryAdjuster for rounding MonetaryAmount
instances given a currency, hereby the rounding must be valid for the
given timestamp. |
static javax.money.MonetaryAdjuster |
getRounding(int scale,
RoundingMode roundingMode)
Creates an rounding instance.
|
static javax.money.MonetaryAdjuster |
getRounding(String customRoundingId)
Access an
MonetaryAdjuster for custom rounding
MonetaryAmount instances. |
public static javax.money.MonetaryAdjuster getRounding()
MonetaryAdjuster
to
chained calculations. The instance will lookup the concrete
MonetaryAdjuster
instance from the MonetaryRoundings
based on the input MonetaryAmount
's CurrencyUnit
.public static javax.money.MonetaryAdjuster getRounding(int scale, RoundingMode roundingMode)
mathContext
- The MathContext
to be used, not null
.public static javax.money.MonetaryAdjuster getRounding(javax.money.CurrencyUnit currency)
MonetaryAdjuster
for rounding MonetaryAmount
instances given a currency.currency
- The currency, which determines the required precision. As
RoundingMode
, by default, RoundingMode.HALF_UP
is sued.MonetaryAdjuster
implementing the
rounding, never null
.public static javax.money.MonetaryAdjuster getCashRounding(javax.money.CurrencyUnit currency)
MonetaryAdjuster
for rounding MonetaryAmount
instances given a currency.currency
- The currency, which determines the required precision. As
RoundingMode
, by default, RoundingMode.HALF_UP
is sued.MonetaryAdjuster
implementing the
rounding, never null
.public static javax.money.MonetaryAdjuster getRounding(javax.money.CurrencyUnit currency, long timestamp)
MonetaryAdjuster
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
RoundingMode
, by default, RoundingMode.HALF_UP
is used.timestamp
- the UTC timestamp.MonetaryAdjuster
implementing the
rounding, or null
.public static javax.money.MonetaryAdjuster getCashRounding(javax.money.CurrencyUnit currency, long timestamp)
MonetaryAdjuster
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
RoundingMode
, by default, RoundingMode.HALF_UP
is sued.timestamp
- the UTC timestamp.MonetaryAdjuster
implementing the
rounding, or null
.public static javax.money.MonetaryAdjuster getRounding(String customRoundingId)
MonetaryAdjuster
for custom rounding
MonetaryAmount
instances.customRounding
- The customRounding identifier.MonetaryAdjuster
implementing the
rounding, never null
.IllegalArgumentException
- if no such rounding is registered using a
RoundingProviderSpi
instance.public static Set<String> getCustomRoundingIds()
null
.Copyright © 2012–2013 JSR 354 - Expert Group. All rights reserved.