public final class MonetaryRoundings extends Object
MonetaryOperator
.
This class is thread-safe.
Modifier and Type | Method and Description |
---|---|
static List<String> |
getDefaultProviderChain()
Allows to access the default providers chain usef if no provider chain was passed explicitly..
|
static MonetaryRounding |
getDefaultRounding()
Creates a rounding that can be added as
MonetaryOperator to
chained calculations. |
static Set<String> |
getProviderNames()
Allows to access the names of the current registered providers.
|
static MonetaryRounding |
getRounding(CurrencyUnit currencyUnit,
String... providers)
Creates an
MonetaryOperator for rounding MonetaryAmount
instances given a currency. |
static MonetaryRounding |
getRounding(RoundingQuery roundingQuery)
Access a
MonetaryRounding using a possibly complex query. |
static MonetaryRounding |
getRounding(String roundingName,
String... providers)
Access an
MonetaryOperator for custom rounding
MonetaryAmount instances. |
static Set<String> |
getRoundingNames(String... providers)
Allows to access the names of the current defined roundings.
|
static Collection<MonetaryRounding> |
getRoundings(RoundingQuery roundingQuery)
Access multiple
MonetaryRounding instances using a possibly complex query |
static boolean |
isRoundingAvailable(CurrencyUnit currencyUnit,
String... providers)
Checks if a
MonetaryRounding is available given a roundingId. |
static boolean |
isRoundingAvailable(RoundingQuery roundingQuery)
Checks if a
MonetaryRounding matching the query is available. |
static boolean |
isRoundingAvailable(String roundingName,
String... providers)
Checks if a
MonetaryRounding is available given a roundingId. |
public static MonetaryRounding getDefaultRounding()
MonetaryOperator
to
chained calculations. The instance will lookup the concrete
MonetaryOperator
instance from the MonetaryRoundings
based on the input MonetaryAmount
's CurrencyUnit
.public static MonetaryRounding getRounding(CurrencyUnit currencyUnit, String... providers)
MonetaryOperator
for rounding MonetaryAmount
instances given a currency.currencyUnit
- The currency, which determines the required scale. As
RoundingMode
, by default, RoundingMode.HALF_UP
is used.providers
- the providers and ordering to be used. By default providers and ordering as defined in
#getDefaultProviders is used.MonetaryOperator
implementing the
rounding, never null
.public static MonetaryRounding getRounding(String roundingName, String... providers)
MonetaryOperator
for custom rounding
MonetaryAmount
instances.roundingName
- The rounding identifier.providers
- the providers and ordering to be used. By default providers and ordering as defined in
#getDefaultProviders is used.MonetaryOperator
implementing the
rounding, never null
.IllegalArgumentException
- if no such rounding is registered using a
RoundingProviderSpi
instance.public static MonetaryRounding getRounding(RoundingQuery roundingQuery)
MonetaryRounding
using a possibly complex query.roundingQuery
- The RoundingQuery
that may contains arbitrary parameters to be
evaluated.MonetaryRounding
, never null
.IllegalArgumentException
- if no such rounding is registered using a
RoundingProviderSpi
instance.public static boolean isRoundingAvailable(String roundingName, String... providers)
MonetaryRounding
is available given a roundingId.roundingName
- The rounding identifier.providers
- the providers and ordering to be used. By default providers and ordering as defined in
#getDefaultProviders is used.MonetaryRounding
is available.IllegalArgumentException
- if no such rounding is registered using a
RoundingProviderSpi
instance.public static boolean isRoundingAvailable(CurrencyUnit currencyUnit, String... providers)
MonetaryRounding
is available given a roundingId.currencyUnit
- The currency, which determines the required scale. As RoundingMode
,
by default, RoundingMode.HALF_UP
is used.providers
- the providers and ordering to be used. By default providers and ordering as defined in
#getDefaultProviders is used.MonetaryRounding
is available.IllegalArgumentException
- if no such rounding is registered using a
RoundingProviderSpi
instance.public static boolean isRoundingAvailable(RoundingQuery roundingQuery)
MonetaryRounding
matching the query is available.roundingQuery
- The RoundingQuery
that may contains arbitrary parameters to be
evaluated.MonetaryRounding
is available.IllegalArgumentException
- if no such rounding is registered using a
RoundingProviderSpi
instance.public static Collection<MonetaryRounding> getRoundings(RoundingQuery roundingQuery)
MonetaryRounding
instances using a possibly complex queryroundingQuery
- The RoundingQuery
that may contains arbitrary parameters to be
evaluated.MonetaryRounding
instances macthing the query, never null
.public static Set<String> getRoundingNames(String... providers)
providers
- the providers and ordering to be used. By default providers and ordering as defined in
#getDefaultProviders is used.null
.public static Set<String> getProviderNames()
null
.Copyright © 2012–2015 JSR 354 - Expert Group. All rights reserved.