/** * Creates a simple format query based on a singlet Locale, similar to {@link java.text.DecimalFormat#getInstance * (java.util.Locale)}. * * @param locale the target locale, not null. * @param providers the providers to be used, not null. * @return a new query instance */ public static AmountFormatQuery of(Locale locale, String... providers) { return AmountFormatQueryBuilder.of(locale).setProviderNames(providers).build(); }
/** * Access the default {@link MonetaryAmountFormat} given a {@link Locale}. * * @param locale the target {@link Locale}, not {@code null}. * @param providers The (optional) providers to be used, ordered correspondingly. * @return the matching {@link MonetaryAmountFormat} * @throws MonetaryException if no registered {@link MonetaryAmountFormatProviderSpi} can provide a * corresponding {@link MonetaryAmountFormat} instance. */ default MonetaryAmountFormat getAmountFormat(Locale locale, String... providers) { return getAmountFormat(AmountFormatQueryBuilder.of(locale).setProviderNames(providers).build()); }
/** * Access the default {@link MonetaryAmountFormat} given a {@link Locale}. * * @param formatName the target format name, not {@code null}. * @param providers The (optional) providers to be used, ordered correspondingly. * @return the matching {@link MonetaryAmountFormat} * @throws MonetaryException if no registered {@link MonetaryAmountFormatProviderSpi} can provide a * corresponding {@link MonetaryAmountFormat} instance. */ default MonetaryAmountFormat getAmountFormat(String formatName, String... providers) { return getAmountFormat(AmountFormatQueryBuilder.of(formatName).setProviderNames(providers).build()); }
/** * Access the a {@link MonetaryAmountFormat} given its styleId. * * @param formatName the target format name, not {@code null}. * @param providers The providers to be used, if not set the providers as defined by #getDefaultCurrencyProviderChain() are * used. * @return the matching {@link MonetaryAmountFormat} * @throws MonetaryException if no registered {@link MonetaryAmountFormatProviderSpi} can provide a * corresponding {@link MonetaryAmountFormat} instance. */ public static MonetaryAmountFormat getAmountFormat(String formatName, String... providers) { return getAmountFormat(AmountFormatQueryBuilder.of(formatName).setProviderNames(providers).build()); }
/** * Access the default {@link MonetaryAmountFormat} given a {@link Locale}. * * @param locale the target {@link Locale}, not {@code null}. * @param providers The providers to be queried, if not set the providers as defined by #getDefaultCurrencyProviderChain() * are queried. * @return the matching {@link MonetaryAmountFormat} * @throws MonetaryException if no registered {@link MonetaryAmountFormatProviderSpi} can provide a * corresponding {@link MonetaryAmountFormat} instance. */ public static MonetaryAmountFormat getAmountFormat(Locale locale, String... providers) { return getAmountFormat(AmountFormatQueryBuilder.of(locale).setProviderNames(providers).setLocale(locale).build()); }