java.lang.Object
javax.money.DefaultMonetaryRoundingsSingletonSpi
- All Implemented Interfaces:
MonetaryRoundingsSingletonSpi
public final class DefaultMonetaryRoundingsSingletonSpi extends java.lang.Object implements MonetaryRoundingsSingletonSpi
This class models the accessor for rounding instances, modeled as
MonetaryOperator
.
This class is thread-safe.
- Author:
- Anatole Tresch, Werner Keil
-
Constructor Summary
Constructors Constructor Description DefaultMonetaryRoundingsSingletonSpi()
-
Method Summary
Modifier and Type Method Description RoundingQueryBuilder
createRoundingQueryBuilder()
Creates an rounding instance usingRoundingMode.UP
rounding.java.util.List<java.lang.String>
getDefaultProviderChain()
Get the default providers list to be used.MonetaryRounding
getDefaultRounding()
Get the default rounding, which delegates rounding dynamically depending on the current currency.java.util.Set<java.lang.String>
getProviderNames()
Get the names of all current registered providers.java.util.Set<java.lang.String>
getRoundingNames(java.lang.String... providers)
Allows to access the identifiers of the current defined roundings.java.util.Collection<MonetaryRounding>
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, wait
Methods inherited from interface javax.money.spi.MonetaryRoundingsSingletonSpi
getRounding, getRounding, getRounding, isRoundingAvailable, isRoundingAvailable, isRoundingAvailable
-
Constructor Details
-
DefaultMonetaryRoundingsSingletonSpi
public DefaultMonetaryRoundingsSingletonSpi()
-
-
Method Details
-
createRoundingQueryBuilder
Creates an rounding instance usingRoundingMode.UP
rounding.- Returns:
- the corresponding
MonetaryOperator
implementing 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:
getDefaultRounding
in interfaceMonetaryRoundingsSingletonSpi
- Returns:
- the default rounding, never null.
-
getRoundings
Query all roundings matching the givenRoundingQuery
.- Specified by:
getRoundings
in interfaceMonetaryRoundingsSingletonSpi
- Parameters:
query
- the rounding query, not null.- Returns:
- the collection found, not null.
-
getProviderNames
public java.util.Set<java.lang.String> getProviderNames()Get the names of all current registered providers.- Specified by:
getProviderNames
in interfaceMonetaryRoundingsSingletonSpi
- Returns:
- the names of all current registered providers, never null.
-
getDefaultProviderChain
public java.util.List<java.lang.String> getDefaultProviderChain()Get the default providers list to be used.- Specified by:
getDefaultProviderChain
in interfaceMonetaryRoundingsSingletonSpi
- Returns:
- the default provider list and ordering, not null.
- See Also:
RoundingQueryBuilder
-
getRoundingNames
public java.util.Set<java.lang.String> getRoundingNames(java.lang.String... providers)Allows to access the identifiers of the current defined roundings.- Specified by:
getRoundingNames
in 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
.
-