Class CurrentCurrencyUtils
- java.lang.Object
-
- com.broadleafcommerce.data.tracking.core.mapping.money.CurrentCurrencyUtils
-
public class CurrentCurrencyUtils extends Object
Untility to allow for resolving the currency based on a supplied object and / or theContextInfo.- Author:
- Kelly Tisdell (ktisdell)
-
-
Constructor Summary
Constructors Constructor Description CurrentCurrencyUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static javax.money.CurrencyUnitresolveCurrentCurrency(ContextInfo contextInfo)Returns theCurrencyUnitthat matches theContextInfo.getDefaultCurrency().static javax.money.CurrencyUnitresolveCurrentCurrency(Object currencySupplier, ContextInfo contextInfo)Returns theCurrencyUnitthat most closely matches the parameters provided.
-
-
-
Method Detail
-
resolveCurrentCurrency
@NonNull public static javax.money.CurrencyUnit resolveCurrentCurrency(@Nullable ContextInfo contextInfo)Returns theCurrencyUnitthat matches theContextInfo.getDefaultCurrency(). If theContextInfois null, orContextInfo.getDefaultCurrency()is null, then this returns the default system currency fromMonetaryUtils.defaultCurrency().- Parameters:
contextInfo-- Returns:
- See Also:
ContextInfoCustomizer
-
resolveCurrentCurrency
@NonNull public static javax.money.CurrencyUnit resolveCurrentCurrency(@Nullable Object currencySupplier, @Nullable ContextInfo contextInfo)Returns theCurrencyUnitthat most closely matches the parameters provided. First, if the currencySupplier is not null and is an instance ofCurrencySupplierthenCurrencySupplier.getCurrency()will be called. If the currencySupplier argument is null or is not an instance ofCurrencySupplieror contains a null currency, then theContextInfowill be queried. If theContextInfois not null, andContextInfo.getDefaultCurrency()is not null, then that is what will be returned. Finally, if no currency could be resolved from the currencySupplier argument or the contextInfo argument, then the default system currency will be used, resolved fromMonetaryUtils.defaultCurrency().- Parameters:
currencySupplier-contextInfo-- Returns:
- See Also:
ContextInfoCustomizer
-
-