public class CurrencyUtils
extends java.lang.Object
| Constructor and Description |
|---|
CurrencyUtils() |
| Modifier and Type | Method and Description |
|---|---|
java.math.BigDecimal |
applyRounding(java.math.BigDecimal price,
java.lang.String currencyIsoCode)
Applies the scaling and rounding to a given price, based on declared currency code
|
java.math.BigDecimal |
convertCurrency(java.lang.String sourceCurrencyIsoCode,
java.lang.String targetCurrencyIsoCode,
java.math.BigDecimal sourceValue)
Given the source and target currency codes, converts the value from one currency to another
|
protected CommonI18NService |
getCommonI18NService() |
CurrencyModel |
getCurrency(java.lang.String currencyCode)
Provides an instance of
CurrencyModel for a given currency code |
java.util.Optional<java.lang.Integer> |
getDigitsOfCurrency(java.lang.String currencyIsoCode)
Provides number of digits defined for the currency that identifies itself by the provided currency iso code
|
java.lang.Integer |
getDigitsOfCurrencyOrDefault(java.lang.String currencyIsoCode)
Provides number of digits defined for the currency that identifies itself by the provided currency iso code
|
void |
setCommonI18NService(CommonI18NService commonI18NService) |
public java.math.BigDecimal applyRounding(java.math.BigDecimal price,
java.lang.String currencyIsoCode)
price - - the value to apply the rounding tocurrencyIsoCode - - currency codepublic java.math.BigDecimal convertCurrency(java.lang.String sourceCurrencyIsoCode,
java.lang.String targetCurrencyIsoCode,
java.math.BigDecimal sourceValue)
sourceCurrencyIsoCode - - source currency codetargetCurrencyIsoCode - - target currency codesourceValue - - the source value to apply the conversion forpublic java.util.Optional<java.lang.Integer> getDigitsOfCurrency(java.lang.String currencyIsoCode)
currencyIsoCode - currency ISO codepublic java.lang.Integer getDigitsOfCurrencyOrDefault(java.lang.String currencyIsoCode)
currencyIsoCode - currency ISO codepublic CurrencyModel getCurrency(java.lang.String currencyCode)
CurrencyModel for a given currency codecurrencyCode - currency codeCurrencyModel that matches provided currency code{@link - RuleEvaluationException} in case provided currency code is empty or there is no currency with provided currency codeprotected CommonI18NService getCommonI18NService()
public void setCommonI18NService(CommonI18NService commonI18NService)
Copyright © 2018 SAP SE. All Rights Reserved.