Skip to content

Configuration of currency style without dependency on an implementation #83

Open

Description

@vb-chris

I'm trying to create a MonetaryAmountFormat that uses the currency unit symbol:

MonetaryAmountFormat format = MonetaryFormats.getAmountFormat(
  AmountFormatQueryBuilder.of(Locale.GERMANY)
                          .set(org.javamoney.moneta.format.CurrencyStyle.SYMBOL)
                          .set("pattern", "#,##0.##¤")
                          .build()
);

The java/maven project has a dependency on moneta in runtime (not compile-time) scope. It seems that the class CurrencyStyle and its value SYMBOL are part of moneta, the java-money reference implementation, and not part of the java-money API. Thus, the code does not compile.

I'd prefer to create a MonetaryAmountFormat that uses the currency unit symbol without a compile-time dependency on an implementation.

(previously asked on Stack Overflow)

Activity

  1. keilw commented on Jun 25, 2018

    @keilw
    Member

    @vb-chris Do you suggest, CurrencyStyle should probably move to the API here?
    We cannot change the API right now without a working Spec Lead or Maintenance Lead, but we're hoping to have a new Money JSR in the near future to deal with those API changes.

  2. vb-chris commented on Jun 25, 2018

    @vb-chris
    Author

    Movement of CurrencyStyle seems appropriate to me when all implementations are required to support all options.
    For my use case, it would be sufficient when the API defined a Key/Value-Pair of Strings which is respected by implementations.

  3. keilw commented on Jun 25, 2018

    @keilw
    Member

    We have some possible new features for a possible new Money API, trying to use the Configuration API from JSR 382 is among them, not only for this particular case, but others like ExchangeRateProviders, etc.

  4. added this to the .Next milestone on Jul 20, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions