Class DefaultTmaPriceValueFormatter
- java.lang.Object
-
- de.hybris.platform.b2ctelcofacades.price.impl.DefaultTmaPriceValueFormatter
-
- All Implemented Interfaces:
TmaPriceValueFormatter
public class DefaultTmaPriceValueFormatter extends java.lang.Object implements TmaPriceValueFormatter
Default implementation of the price value formatter.- Since:
- 2007
-
-
Constructor Summary
Constructors Constructor Description DefaultTmaPriceValueFormatter(de.hybris.platform.servicelayer.i18n.CommonI18NService commonI18NService, de.hybris.platform.commerceservices.i18n.CommerceCommonI18NService commerceCommonI18NService, de.hybris.platform.servicelayer.i18n.I18NService i18NService)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.text.DecimalFormatadjustDigits(java.text.DecimalFormat format, CurrencyModel currencyModel)AdjustsDecimalFormat's fraction digits according to givenCurrencyModel.protected java.text.DecimalFormatadjustSymbol(java.text.DecimalFormat format, CurrencyModel currencyModel)AdjustsDecimalFormat's symbol according to givenCurrencyModel.protected java.text.NumberFormatcreateCurrencyFormat(java.util.Locale locale, CurrencyModel currency)Returns the currency formatted based on the given localeprotected java.text.NumberFormatcreateNumberFormat(java.util.Locale locale, CurrencyModel currency)java.lang.StringformatPriceValue(java.math.BigDecimal value, CurrencyModel currency)Obtains a formatted string for the given price value and currency.protected de.hybris.platform.commerceservices.i18n.CommerceCommonI18NServicegetCommerceCommonI18NService()protected de.hybris.platform.servicelayer.i18n.CommonI18NServicegetCommonI18NService()protected de.hybris.platform.servicelayer.i18n.I18NServicegetI18NService()
-
-
-
Constructor Detail
-
DefaultTmaPriceValueFormatter
public DefaultTmaPriceValueFormatter(de.hybris.platform.servicelayer.i18n.CommonI18NService commonI18NService, de.hybris.platform.commerceservices.i18n.CommerceCommonI18NService commerceCommonI18NService, de.hybris.platform.servicelayer.i18n.I18NService i18NService)
-
-
Method Detail
-
formatPriceValue
public java.lang.String formatPriceValue(java.math.BigDecimal value, CurrencyModel currency)Description copied from interface:TmaPriceValueFormatterObtains a formatted string for the given price value and currency.- Specified by:
formatPriceValuein interfaceTmaPriceValueFormatter- Parameters:
value- the price valuecurrency- the currency- Returns:
- formatted String with the price value and currency
-
createCurrencyFormat
protected java.text.NumberFormat createCurrencyFormat(java.util.Locale locale, CurrencyModel currency)Returns the currency formatted based on the given locale- Parameters:
locale- current locale which determines how the currency should be formatted.currency- currency which needs to be formatted- Returns:
- A clone of
NumberFormatfrom the instance in the local cache, if the cache does not contain an instance of a NumberFormat for a given locale and currency one would be added.
-
createNumberFormat
protected java.text.NumberFormat createNumberFormat(java.util.Locale locale, CurrencyModel currency)
-
adjustDigits
protected java.text.DecimalFormat adjustDigits(java.text.DecimalFormat format, CurrencyModel currencyModel)AdjustsDecimalFormat's fraction digits according to givenCurrencyModel.- Parameters:
format- decimal format which needs to be adjusted based on the input currency.currencyModel- currency to be used in the formatting logic- Returns:
- adjusted value based on the given currency's digits.
-
adjustSymbol
protected java.text.DecimalFormat adjustSymbol(java.text.DecimalFormat format, CurrencyModel currencyModel)AdjustsDecimalFormat's symbol according to givenCurrencyModel.- Parameters:
format- decimal format which needs to be adjusted based on the input currency.currencyModel- currency to be used in the formatting logic- Returns:
- adjusted value based on the given currency's symbol.
-
getCommonI18NService
protected de.hybris.platform.servicelayer.i18n.CommonI18NService getCommonI18NService()
-
getCommerceCommonI18NService
protected de.hybris.platform.commerceservices.i18n.CommerceCommonI18NService getCommerceCommonI18NService()
-
getI18NService
protected de.hybris.platform.servicelayer.i18n.I18NService getI18NService()
-
-