I have an instance of javax.money.CurrencyUnit
and I want to display what is it's name in a given locale (for example "US Dollars", "Euro", "Japenese Yen", etc). I've read all the documentation but the only thing I was able to find is how to format a MonetaryAmount
:
MonetaryFormats.getAmountFormat(AmountFormatQueryBuilder.of(Locale.US).set(CurrencyStyle.NAME).set("pattern", "00,00,00,00.00 ยค").build()).format(myCurrencyUnit);
And I can see there I specify CurrencyStyle.NAME
so it will return the currency name in the result, but the problem is I don't have a MonetaryAmount
and I couldn't find a formatter for CurrencyUnit
.
Thank you