@@ -75,9 +75,9 @@ You can use the currency code to access currencies.
7575[source,java]
7676.Accessing currencies by currency code
7777--------------------------------------------
78- CurrencyUnit currencyCHF = MonetaryCurrencies .getCurrencyUnit("CHF");
79- CurrencyUnit currencyUSD = MonetaryCurrencies .getCurrencyUnit("USD");
80- CurrencyUnit currencyEUR = MonetaryCurrencies .getCurrencyUnit("EUR");
78+ CurrencyUnit currencyCHF = Monetary .getCurrencyUnit("CHF");
79+ CurrencyUnit currencyUSD = Monetary .getCurrencyUnit("USD");
80+ CurrencyUnit currencyEUR = Monetary .getCurrencyUnit("EUR");
8181--------------------------------------------
8282
8383Hereby all codes available in the underlying JDK are mapped by default.
@@ -98,9 +98,9 @@ Similarly to +java.util.Currency+ a +CurrencyUnit+ can be accessed using this +L
9898[source,java]
9999.Accessing currencies by Locale
100100--------------------------------------------
101- CurrencyUnit currencyCHF = MonetaryCurrencies .getCurrencyUnit(new Locale("", "SUI")); // Switzerland
102- CurrencyUnit currencyUSD = MonetaryCurrencies .getCurrencyUnit(new Locale("", "USA")); // United States of America
103- CurrencyUnit currencyEUR = MonetaryCurrencies .getCurrencyUnit(new Locale("", "GER")); // Germany
101+ CurrencyUnit currencyCHF = Monetary .getCurrencyUnit(new Locale("", "SUI")); // Switzerland
102+ CurrencyUnit currencyUSD = Monetary .getCurrencyUnit(new Locale("", "USA")); // United States of America
103+ CurrencyUnit currencyEUR = Monetary .getCurrencyUnit(new Locale("", "GER")); // Germany
104104--------------------------------------------
105105
106106Hereby all codes available in the underlying JDK are mapped by default.
@@ -112,7 +112,7 @@ Also all currently known currencies can be accessed:
112112[source,java]
113113.Accessing all currencies
114114--------------------------------------------
115- Collection<CurrencyUnit> allCurrencies = MonetaryCurrencies .getCurrencies();
115+ Collection<CurrencyUnit> allCurrencies = Monetary .getCurrencies();
116116--------------------------------------------
117117
118118Similarly to other access methods you can also explicitly specifiy the provider chain to be used. The _Moneta_
@@ -235,8 +235,8 @@ sublist, when the according code is requested, or a unspecified request is perfo
235235CurrencyUnit unit = CurrencyUnitBuilder.of("FLS22").setDefaultFractionUnits(3).build();
236236
237237// registering it
238- MonetaryCurrencies .registerCurrency(unit);
239- MonetaryCurrencies .registerCurrency(unit, Locale.MyCOUNTRY);
238+ Monetary .registerCurrency(unit);
239+ Monetary .registerCurrency(unit, Locale.MyCOUNTRY);
240240--------------------------------------------
241241
242242Fortunately +CurrencyUnitBuilder+ is also capable of registering a currency on creation, by just passing
@@ -256,8 +256,8 @@ Alternatively one may use the +MonetaryCurrencies+ static methods as follows:
256256CurrencyUnit unit = new CurrencyUnitBuilder.of("FLS22").setDefaultFractionUnits(3).build();
257257
258258// registering it
259- MonetaryCurrencies .registerCurrency(unit);
260- MonetaryCurrencies .registerCurrency(unit, Locale.MyCOUNTRY);
259+ Monetary .registerCurrency(unit);
260+ Monetary .registerCurrency(unit, Locale.MyCOUNTRY);
261261--------------------------------------------
262262
263263==== Provided Currencies
@@ -291,7 +291,7 @@ new instances of amounts. E.g. instances of +FastMoney+ can be created as follow
291291[source,java]
292292.Creating instances of +FastMoney+ using the +MonetaryAmounts+ singleton:
293293--------------------------------------------
294- FastMoney m = MonetaryAmounts .getAmountFactory(FastMoney.class).setCurrency("USD").setNumber(200.20).create();
294+ FastMoney m = Monetary .getAmountFactory(FastMoney.class).setCurrency("USD").setNumber(200.20).create();
295295--------------------------------------------
296296
297297Additionally _Moneta_ also supports static factory methods on the types directly. So the following code is equivalent:
@@ -307,7 +307,7 @@ Creation of +Money+ instances is similar:
307307[source,java]
308308.Creating instances of +Money+:
309309--------------------------------------------
310- Money m1 = MonetaryAmounts .getAmountFactory(Money.class).setCurrency("USD").setNumber(200.20).create();
310+ Money m1 = Monetary .getAmountFactory(Money.class).setCurrency("USD").setNumber(200.20).create();
311311Money m2 = Money.of("USD", 200.20);
312312--------------------------------------------
313313
@@ -329,7 +329,7 @@ Using the JSR's main API allows to achieve the same as follows:
329329[source,java]
330330.Creating instances of +Money+ configuring the +MathContext+ to be used, using the +MonetaryAmountFactory+.
331331--------------------------------------------
332- Money money = MonetaryAmounts .getAmountFactory(Money.class)
332+ Money money = Monetary .getAmountFactory(Money.class)
333333 .setCurrencyUnit("CHF").setNumber(200).
334334 ,setContext(MonetaryContextBuilder.create().set(MathContext.DECIMAL128).build())
335335 .create();
@@ -488,7 +488,7 @@ M money1 = money1.add(M.of(EURO, 1234567.3444));
488488money1 = money1.subtract(M.of(EURO, 232323));
489489money1 = money1.multiply(3.4);
490490money1 = money1.divide(5.456);
491- money1 = money1.with(MonetaryRoundings .getRounding());
491+ money1 = money1.with(Monetary .getRounding());
492492--------------------------------------------
493493
494494All tests were executed on a notebook with an +Intel i7 2.6GHz+ processor with SSD.
@@ -526,7 +526,7 @@ the +RoundingQuery+ passed:
526526[source,java]
527527.Access and apply arithmetic rounding.
528528--------------------------------------------
529- MonetaryRounding rounding = MonetaryRoundings .getRounding(
529+ MonetaryRounding rounding = Monetary .getRounding(
530530 RoundingQueryBuilder.create().setScale(4).set(RoundingMode.HALF_UP).build());
531531MonetaryAmount amt = ...;
532532MonetaryAmount roundedAmount = amt.with(rounding);
@@ -540,9 +540,9 @@ based on the current amount instance to be rounded:
540540[source,java]
541541.Access and apply default rounding.
542542--------------------------------------------
543- MonetaryRounding rounding = MonetaryRoundings .getDefaultRounding();
543+ MonetaryRounding rounding = Monetary .getDefaultRounding();
544544MonetaryAmount amt = ...;
545- MonetaryAmount roundedAmount = amt.with(rounding); // implicitly uses MonetaryRoundings .getRounding(CurrencyUnit);
545+ MonetaryAmount roundedAmount = amt.with(rounding); // implicitly uses Monetary .getRounding(CurrencyUnit);
546546--------------------------------------------
547547
548548Also you can access the default rounding for a given +CurrencyUnit+. Be default this will return an arithmetic rounding
@@ -552,9 +552,9 @@ based on the currency's _default fraction digits_, but it may also return a non
552552.Access and apply default currency rounding.
553553--------------------------------------------
554554CurrencyUnit currency = ...;
555- MonetaryRounding rounding = MonetaryRoundings .getRounding(currency);
555+ MonetaryRounding rounding = Monetary .getRounding(currency);
556556MonetaryAmount amt = ...;
557- MonetaryAmount roundedAmount = amt.with(rounding); // implicitly uses MonetaryRoundings .getRounding(CurrencyUnit);
557+ MonetaryAmount roundedAmount = amt.with(rounding); // implicitly uses Monetary .getRounding(CurrencyUnit);
558558--------------------------------------------
559559
560560For Swiss Francs also a corresponding cash rounding is accessible. In Switzerland the smallest minor in cash are
@@ -564,7 +564,7 @@ For Swiss Francs also a corresponding cash rounding is accessible. In Switzerlan
564564[source,java]
565565.Access Swiss Francs Cash Rounding
566566--------------------------------------------
567- MonetaryRounding rounding = MonetaryRoundings .getRounding(MonetaryCurrencies .getCurrency("CHF"),
567+ MonetaryRounding rounding = Monetary .getRounding(Monetary .getCurrency("CHF"),
568568 RoundingQueryBuilder.create().set("cashRounding", true).build()
569569);
570570MonetaryAmount amt = ...;
0 commit comments