Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configuration of currency style without dependency on an implementation #83

Open
vb-chris opened this issue Jun 25, 2018 · 3 comments
Open

Comments

@vb-chris
Copy link

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)

@keilw
Copy link
Member

keilw commented Jun 25, 2018

@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.

@vb-chris
Copy link
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.

@keilw
Copy link
Member

keilw commented Jun 25, 2018

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.

@keilw keilw added this to the .Next milestone Jul 20, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants