public class DefaultCurrencyAmountResolutionStrategy extends Object implements PromotionMessageParameterResolutionStrategy
RuleParameterData.getValue() attribute into a
formatted currency amount, for example $200.00. The value attribute is cast into a Map<String,BigDecimal> and
the given PromotionResultModel.getOrder()'s currency isocode is used as key to lookup the amount to be
formatted.| Constructor and Description |
|---|
DefaultCurrencyAmountResolutionStrategy() |
| Modifier and Type | Method and Description |
|---|---|
protected DecimalFormat |
adjustDigits(DecimalFormat format,
CurrencyModel currency)
Adjusts
DecimalFormat's fraction digits according to given CurrencyModel. |
protected static DecimalFormat |
adjustSymbol(DecimalFormat format,
CurrencyModel currency)
Adjusts
DecimalFormat's symbol according to given CurrencyModel. |
protected String |
formatCurrencyAmount(Locale locale,
CurrencyModel currency,
BigDecimal amount)
Format an amount in a currency for a locale.
|
RuleParameterData |
getReplacedParameter(RuleParameterData paramToReplace,
PromotionResultModel promotionResult,
Object actualValueAsObject)
returns
RuleParameterData created from given RuleParameterData with replaced actual value. |
String |
getValue(RuleParameterData data,
PromotionResultModel promotionResult,
Locale locale)
resolves the given
RuleParameterData into a displayable Object. |
public DefaultCurrencyAmountResolutionStrategy()
public String getValue(RuleParameterData data, PromotionResultModel promotionResult, Locale locale)
PromotionMessageParameterResolutionStrategyRuleParameterData into a displayable Object.getValue in interface PromotionMessageParameterResolutionStrategydata - the rule parameter to resolvepromotionResult - the promotion resultlocale - the locale#toString()IllegalArgumentException - if any of the given parameters is nullClassCastException - if the given data.getValue() doesn't contain a Mappublic RuleParameterData getReplacedParameter(RuleParameterData paramToReplace, PromotionResultModel promotionResult, Object actualValueAsObject)
PromotionMessageParameterResolutionStrategyRuleParameterData created from given RuleParameterData with replaced actual value.getReplacedParameter in interface PromotionMessageParameterResolutionStrategyparamToReplace - original rule parameterpromotionResult - the promotion resultactualValueAsObject - actual value to set#toString()protected String formatCurrencyAmount(Locale locale, CurrencyModel currency, BigDecimal amount)
locale - the java locale that the amount should be rendered incurrency - the hybris currency model for the amountamount - the valueprotected DecimalFormat adjustDigits(DecimalFormat format, CurrencyModel currency)
DecimalFormat's fraction digits according to given CurrencyModel.protected static DecimalFormat adjustSymbol(DecimalFormat format, CurrencyModel currency)
DecimalFormat's symbol according to given CurrencyModel.Copyright © 2017 SAP SE. All Rights Reserved.