Module java.money

Interface RoundingProviderSpi


public interface RoundingProviderSpi
This SPI allows to extends/override the roundings available for CurrencyUnit. The JSRs implementation already provides default roundings. By registering instances of this interface using the Bootstrap, the default behaviour can be overridden and extended, e.g. for supporting also special roundings.

Implementations of this interface must be

  • thread-safe
  • not require loading of other resources.
If required, it is possible to implement this interface in a contextual way, e.g. providing different roundings depending on the current EE application context. Though in most cases rounding should be a general concept that does not require contextual handling.
Author:
Anatole Tresch
  • Method Summary

    Modifier and Type Method Description
    default java.lang.String getProviderName()
    Get the provider's unique name.
    MonetaryRounding getRounding​(RoundingQuery query)
    Evaluate the rounding that match the given query.
    java.util.Set<java.lang.String> getRoundingNames()
    Access the ids of the roundings defined by this provider.
  • Method Details

    • getRounding

      MonetaryRounding getRounding​(RoundingQuery query)
      Evaluate the rounding that match the given query.
      Parameters:
      query - the rounding query.
      Returns:
      the matching rounding instance, or null.
    • getRoundingNames

      java.util.Set<java.lang.String> getRoundingNames()
      Access the ids of the roundings defined by this provider.
      Returns:
      the ids of the defined roundings, never null.
    • getProviderName

      default java.lang.String getProviderName()
      Get the provider's unique name.
      Returns:
      the provider's unique name, not null.