@@ -95,194 +95,4 @@ public static final Set<Locale> getAvailableLocales() {
9595 return AmountStyle .getAvailableLocales ();
9696 }
9797
98- // /**
99- // * Builder for creating new instances of {@link MonetaryAmountFormat}.
100- // */
101- // public static final class Builder {
102- // /** The default {@link CurrencyUnit}, may be null. */
103- // private CurrencyUnit defaultCurrency;
104- // /** The required {@link MonetaryContext}, may be null. */
105- // private MonetaryContext monetaryContext;
106- // /** The {@link AmountStyle} to be used, may be null, when an {@link Locale} is set. */
107- // private AmountStyle.Builder styleBuilder;
108- // /** The format's name (optional). */
109- // private String name;
110- //
111- // /**
112- // * Creates a new {@link Builder}, hereby the {@link AmountStyle} is determined by the
113- // * {@link Locale} given.
114- // *
115- // * @param locale
116- // * the target {@link Locale}.
117- // */
118- // public Builder(Locale locale) {
119- // Objects.requireNonNull(locale, "Locale required.");
120- // this.styleBuilder = new AmountStyle.Builder(locale);
121- // }
122- //
123- // /**
124- // * Sets the format's name.
125- // *
126- // * @param name
127- // * the name, not null.
128- // * @return the {@link Builder}, for chaining.
129- // */
130- // public Builder setName(String name) {
131- // this.name = name;
132- // return this;
133- // }
134- //
135- // /**
136- // * Sets the default {@link CurrencyUnit} to be used, when parsing amounts where no currency
137- // * is available on the input.
138- // *
139- // * @param defaultCurrency
140- // * the default {@link CurrencyUnit}
141- // * @return the {@link Builder}, for chaining.
142- // */
143- // public Builder setDefaultCurrency(CurrencyUnit defaultCurrency) {
144- // this.defaultCurrency = defaultCurrency;
145- // return this;
146- // }
147- //
148- // /**
149- // * Sets the {@link CurrencyStyle} to be used.
150- // *
151- // * @param currencyFormat
152- // * the {@link CurrencyStyle}, not null.
153- // * @return the {@link Builder}, for chaining.
154- // */
155- // public Builder setCurrencyStyle(CurrencyStyle currencyStyle) {
156- // this.styleBuilder.setCurrencyStyle(currencyStyle);
157- // return this;
158- // }
159- //
160- // /**
161- // * Sets the {@link CurrencyStyle} to be used.
162- // *
163- // * @param currencyFormat
164- // * the {@link CurrencyStyle}, not null.
165- // * @return the {@link Builder}, for chaining.
166- // */
167- // public Builder setAmountStyle(AmountStyle style) {
168- // this.styleBuilder.setCurrencyStyle(style.getCurrencyStyle());
169- // this.styleBuilder
170- // .setDisplayConversion(style.getDisplayConversion());
171- // this.styleBuilder.setGroupingSizes(style.getGroupingSizes());
172- // this.styleBuilder.setParseConversion(style.getParseConversion());
173- // this.styleBuilder.setPattern(style.getPattern());
174- // this.styleBuilder.setSymbols(style.getSymbols());
175- // return this;
176- // }
177- //
178- // /**
179- // * Sets the {@link MonetaryOperator} to be used as display conversion before formatting the
180- // * amount.
181- // *
182- // * @param conversion
183- // * the {@link MonetaryOperator}, or null.
184- // * @return the {@link Builder}, for chaining.
185- // */
186- // public Builder setDisplayConversion(MonetaryOperator conversion) {
187- // this.styleBuilder.setDisplayConversion(conversion);
188- // return this;
189- // }
190- //
191- // /**
192- // * Sets the {@link MonetaryOperator} to be used as parse conversion after parsing the
193- // * amount.
194- // *
195- // * @param conversion
196- // * the {@link MonetaryOperator}, or null.
197- // * @return the {@link Builder}, for chaining.
198- // */
199- // public Builder setParseConversion(MonetaryOperator conversion) {
200- // this.styleBuilder.setParseConversion(conversion);
201- // return this;
202- // }
203- //
204- // /**
205- // * Sets the customized number group sizes to be used for formatting. Hereby each value in
206- // * the array represents a group size, starting from the decimal point and going up the
207- // * significant digits. The last entry in the array is used as a default group size for all
208- // * subsequent groupings.
209- // *
210- // * @param groupSizes
211- // * the group sizes, not null.
212- // * @return the {@link Builder}, for chaining.
213- // */
214- // public Builder setNumberGroupSizes(int... groupSizes) {
215- // this.styleBuilder.setGroupingSizes(groupSizes);
216- // return this;
217- // }
218- //
219- // /**
220- // * Sets the formats pattern, similar as in {@link java.text.DecimalFormat}.
221- // *
222- // * @param pattern
223- // * the pattern, not null.
224- // * @return the {@link Builder}, for chaining.
225- // */
226- // public Builder setPattern(String pattern) {
227- // this.styleBuilder.setPattern(pattern);
228- // return this;
229- // }
230- //
231- // /**
232- // * Sets the formats {@link AmountFormatSymbols}, similar as in
233- // * {@link java.text.DecimalFormatSymbols}.
234- // *
235- // * @param symbols
236- // * the symbols, not null.
237- // * @return the {@link Builder}, for chaining.
238- // */
239- // public Builder setSymbols(AmountFormatSymbols symbols) {
240- // this.styleBuilder.setSymbols(symbols);
241- // return this;
242- // }
243- //
244- // /**
245- // * Sets the {@link MonetaryContext} that determines the amount implementation class returned
246- // * from parsing.
247- // *
248- // * @param monetaryContext
249- // * the {@link MonetaryContext} to be used, or {@code null} for using the default
250- // * amount type.
251- // * @return the {@link Builder}, for chaining.
252- // * @see javax.money.MonetaryAmounts#queryAmountType(MonetaryContext)
253- // * @see javax.money.MonetaryAmounts#getDefaultAmountType()
254- // * @see javax.money.MonetaryAmounts#getDefaultAmountFactory()
255- // */
256- // public Builder setMonetaryContext(MonetaryContext monetaryContext) {
257- // this.monetaryContext = monetaryContext;
258- // return this;
259- // }
260- //
261- // /**
262- // * Access a new {@link MonetaryAmountFormat}, matching the properties set.
263- // *
264- // * @return a new {@link MonetaryAmountFormat} instance, never {@code null}.
265- // * @throws MonetaryException
266- // * if no registered {@link MonetaryAmountFormatProviderSpi} can provide a
267- // * corresponding {@link MonetaryAmountFormat} instance.
268- // */
269- // public MonetaryAmountFormat create() {
270- // AmountStyle style = styleBuilder.build();
271- // for (MonetaryAmountFormatProviderSpi spi : Bootstrap
272- // .getServices(
273- // MonetaryAmountFormatProviderSpi.class)) {
274- // MonetaryAmountFormat f = spi.getFormat(style);
275- // if (f != null) {
276- // f.setMonetaryContext(monetaryContext);
277- // f.setDefaultCurrency(defaultCurrency);
278- // return f;
279- // }
280- // }
281- // throw new MonetaryException(
282- // "No MonetaryAmountFormat found for amountStyle=" + style
283- // + ", defaultCurrency=" + defaultCurrency
284- // + ", monetaryContext=" + monetaryContext);
285- // }
286- // }
287-
28898}
0 commit comments