- 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 asMonetaryOperator.This class is thread-safe.
- Author:
- Anatole Tresch, Werner Keil
-
-
Constructor Summary
Constructors Constructor Description DefaultMonetaryRoundingsSingletonSpi()
-
Method Summary
Modifier and Type Method Description RoundingQueryBuildercreateRoundingQueryBuilder()Creates an rounding instance usingRoundingMode.UProunding.java.util.List<java.lang.String>getDefaultProviderChain()Get the default providers list to be used.MonetaryRoundinggetDefaultRounding()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
-
-
-
-
Method Detail
-
createRoundingQueryBuilder
public RoundingQueryBuilder createRoundingQueryBuilder()
Creates an rounding instance usingRoundingMode.UProunding.- Returns:
- the corresponding
MonetaryOperatorimplementing the rounding. - Throws:
MonetaryException- if no such rounding could be evaluated.
-
getDefaultRounding
public MonetaryRounding 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
public java.util.Collection<MonetaryRounding> getRoundings(RoundingQuery query)
Query all roundings matching the givenRoundingQuery.- Specified by:
getRoundingsin 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:
getProviderNamesin 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:
getDefaultProviderChainin 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:
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.
-
-