java.lang.Object
javax.money.DefaultMonetaryRoundingsSingletonSpi
- All Implemented Interfaces:
MonetaryRoundingsSingletonSpi
public final class DefaultMonetaryRoundingsSingletonSpi
extends Object
implements MonetaryRoundingsSingletonSpi
This class models the accessor for rounding instances, modeled as
MonetaryOperator.
This class is thread-safe.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static final classDefault Rounding that rounds aMonetaryAmountbased on the amount'sCurrencyUnit. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final MonetaryRoundingAn adaptive rounding instance that transparently looks up the correct rounding. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionCreates an rounding instance usingRoundingMode.UProunding.Get the default providers list to be used.Get the default rounding, which delegates rounding dynamically depending on the current currency.Get the names of all current registered providers.getRoundingNames(String... providers) Allows to access the identifiers of the current defined roundings.getRoundings(RoundingQuery query) Query all roundings matching the givenRoundingQuery.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface javax.money.spi.MonetaryRoundingsSingletonSpi
getRounding, getRounding, getRounding, isRoundingAvailable, isRoundingAvailable, isRoundingAvailable
-
Field Details
-
DEFAULT_ROUNDING
An adaptive rounding instance that transparently looks up the correct rounding.
-
-
Constructor Details
-
DefaultMonetaryRoundingsSingletonSpi
public DefaultMonetaryRoundingsSingletonSpi()
-
-
Method Details
-
createRoundingQueryBuilder
Creates an rounding instance usingRoundingMode.UProunding.- Returns:
- the corresponding
MonetaryOperatorimplementing the rounding. - Throws:
MonetaryException- if no such rounding could be evaluated.
-
getDefaultRounding
Get the default rounding, which delegates rounding dynamically depending on the current currency.- Specified by:
getDefaultRoundingin interfaceMonetaryRoundingsSingletonSpi- Returns:
- the default rounding, never null.
-
getRoundings
Query all roundings matching the givenRoundingQuery.- Specified by:
getRoundingsin interfaceMonetaryRoundingsSingletonSpi- Parameters:
query- the rounding query, not null.- Returns:
- the collection found, not null.
-
getProviderNames
Get the names of all current registered providers.- Specified by:
getProviderNamesin interfaceMonetaryRoundingsSingletonSpi- Returns:
- the names of all current registered providers, never null.
-
getDefaultProviderChain
Get the default providers list to be used.- Specified by:
getDefaultProviderChainin interfaceMonetaryRoundingsSingletonSpi- Returns:
- the default provider list and ordering, not null.
- See Also:
-
getRoundingNames
Allows to access the identifiers of the current defined roundings.- Specified by:
getRoundingNamesin interfaceMonetaryRoundingsSingletonSpi- Parameters:
providers- the providers and ordering to be used. By default providers and ordering as defined in #getDefaultProviders is used, not null.- Returns:
- the set of custom rounding ids, never
null.
-