Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions src/main/java/javax/money/Monetary.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public final class Monetary {
/**
* The used {@link javax.money.spi.MonetaryCurrenciesSingletonSpi} instance.
*/
private static MonetaryCurrenciesSingletonSpi MONETARY_CURRENCIES_SINGLETON_SPI() {
private static MonetaryCurrenciesSingletonSpi monetaryCurrenciesSingletonSpi() {
try {
return Optional.ofNullable(Bootstrap
.getService(MonetaryCurrenciesSingletonSpi.class)).orElseGet(
Expand Down Expand Up @@ -384,7 +384,7 @@ public static boolean isAvailable(MonetaryAmountFactoryQuery query) {
* @throws UnknownCurrencyException if no such currency exists.
*/
public static CurrencyUnit getCurrency(String currencyCode, String... providers) {
return Optional.ofNullable(MONETARY_CURRENCIES_SINGLETON_SPI()).orElseThrow(
return Optional.ofNullable(monetaryCurrenciesSingletonSpi()).orElseThrow(
() -> new MonetaryException("No MonetaryCurrenciesSingletonSpi loaded, check your system setup."))
.getCurrency(currencyCode, providers);
}
Expand All @@ -401,7 +401,7 @@ public static CurrencyUnit getCurrency(String currencyCode, String... providers)
* @throws UnknownCurrencyException if no such currency exists.
*/
public static CurrencyUnit getCurrency(Locale locale, String... providers) {
return Optional.ofNullable(MONETARY_CURRENCIES_SINGLETON_SPI()).orElseThrow(
return Optional.ofNullable(monetaryCurrenciesSingletonSpi()).orElseThrow(
() -> new MonetaryException("No MonetaryCurrenciesSingletonSpi loaded, check your system setup."))
.getCurrency(locale, providers);
}
Expand All @@ -418,7 +418,7 @@ public static CurrencyUnit getCurrency(Locale locale, String... providers) {
* @throws UnknownCurrencyException if no such currency exists.
*/
public static Set<CurrencyUnit> getCurrencies(Locale locale, String... providers) {
return Optional.ofNullable(MONETARY_CURRENCIES_SINGLETON_SPI()).orElseThrow(
return Optional.ofNullable(monetaryCurrenciesSingletonSpi()).orElseThrow(
() -> new MonetaryException("No MonetaryCurrenciesSingletonSpi loaded, check your system setup."))
.getCurrencies(locale, providers);
}
Expand All @@ -433,7 +433,7 @@ public static Set<CurrencyUnit> getCurrencies(Locale locale, String... providers
* would return a result for the given code.
*/
public static boolean isCurrencyAvailable(String code, String... providers) {
return Objects.nonNull(MONETARY_CURRENCIES_SINGLETON_SPI()) && MONETARY_CURRENCIES_SINGLETON_SPI().isCurrencyAvailable(code, providers);
return Objects.nonNull(monetaryCurrenciesSingletonSpi()) && monetaryCurrenciesSingletonSpi().isCurrencyAvailable(code, providers);
}

/**
Expand All @@ -446,7 +446,7 @@ public static boolean isCurrencyAvailable(String code, String... providers) {
* result containing a currency with the given code.
*/
public static boolean isCurrencyAvailable(Locale locale, String... providers) {
return Objects.nonNull(MONETARY_CURRENCIES_SINGLETON_SPI()) && MONETARY_CURRENCIES_SINGLETON_SPI().isCurrencyAvailable(locale, providers);
return Objects.nonNull(monetaryCurrenciesSingletonSpi()) && monetaryCurrenciesSingletonSpi().isCurrencyAvailable(locale, providers);
}

/**
Expand All @@ -456,7 +456,7 @@ public static boolean isCurrencyAvailable(Locale locale, String... providers) {
* @return the list of known currencies, never null.
*/
public static Collection<CurrencyUnit> getCurrencies(String... providers) {
return Optional.ofNullable(MONETARY_CURRENCIES_SINGLETON_SPI()).orElseThrow(
return Optional.ofNullable(monetaryCurrenciesSingletonSpi()).orElseThrow(
() -> new MonetaryException("No MonetaryCurrenciesSingletonSpi loaded, check your system setup."))
.getCurrencies(providers);
}
Expand All @@ -468,7 +468,7 @@ public static Collection<CurrencyUnit> getCurrencies(String... providers) {
* @return the list of known currencies, never null.
*/
public static CurrencyUnit getCurrency(CurrencyQuery query) {
return Optional.ofNullable(MONETARY_CURRENCIES_SINGLETON_SPI()).orElseThrow(
return Optional.ofNullable(monetaryCurrenciesSingletonSpi()).orElseThrow(
() -> new MonetaryException("No MonetaryCurrenciesSingletonSpi loaded, check your system setup."))
.getCurrency(query);
}
Expand All @@ -481,7 +481,7 @@ public static CurrencyUnit getCurrency(CurrencyQuery query) {
* @return the list of known currencies, never null.
*/
public static Collection<CurrencyUnit> getCurrencies(CurrencyQuery query) {
return Optional.ofNullable(MONETARY_CURRENCIES_SINGLETON_SPI()).orElseThrow(
return Optional.ofNullable(monetaryCurrenciesSingletonSpi()).orElseThrow(
() -> new MonetaryException("No MonetaryCurrenciesSingletonSpi loaded, check your system setup."))
.getCurrencies(query);
}
Expand All @@ -492,7 +492,7 @@ public static Collection<CurrencyUnit> getCurrencies(CurrencyQuery query) {
* @return the list of known currencies, never null.
*/
public static Set<String> getCurrencyProviderNames() {
return Optional.ofNullable(MONETARY_CURRENCIES_SINGLETON_SPI()).orElseThrow(
return Optional.ofNullable(monetaryCurrenciesSingletonSpi()).orElseThrow(
() -> new MonetaryException("No MonetaryCurrenciesSingletonSpi loaded, check your system setup."))
.getProviderNames();
}
Expand All @@ -504,7 +504,7 @@ public static Set<String> getCurrencyProviderNames() {
* @return the ordered list provider names, modelling the default provider chain used, never null.
*/
public static List<String> getDefaultCurrencyProviderChain() {
return Optional.ofNullable(MONETARY_CURRENCIES_SINGLETON_SPI()).orElseThrow(
return Optional.ofNullable(monetaryCurrenciesSingletonSpi()).orElseThrow(
() -> new MonetaryException("No MonetaryCurrenciesSingletonSpi loaded, check your system setup."))
.getDefaultProviderChain();
}
Expand Down