Class DefaultTmaPriceValueFormatter

java.lang.Object
de.hybris.platform.b2ctelcofacades.price.impl.DefaultTmaPriceValueFormatter
All Implemented Interfaces:
TmaPriceValueFormatter

public class DefaultTmaPriceValueFormatter extends Object implements TmaPriceValueFormatter
Default implementation of the price value formatter.
Since:
2007
  • Constructor Details

    • 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 Details

    • formatPriceValue

      public String formatPriceValue(BigDecimal value, CurrencyModel currency)
      Description copied from interface: TmaPriceValueFormatter
      Obtains a formatted string for the given price value and currency.
      Specified by:
      formatPriceValue in interface TmaPriceValueFormatter
      Parameters:
      value - the price value
      currency - the currency
      Returns:
      formatted String with the price value and currency
    • createCurrencyFormat

      protected NumberFormat createCurrencyFormat(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 NumberFormat from 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 NumberFormat createNumberFormat(Locale locale, CurrencyModel currency)
    • adjustDigits

      protected DecimalFormat adjustDigits(DecimalFormat format, CurrencyModel currencyModel)
      Adjusts DecimalFormat's fraction digits according to given CurrencyModel.
      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 DecimalFormat adjustSymbol(DecimalFormat format, CurrencyModel currencyModel)
      Adjusts DecimalFormat's symbol according to given CurrencyModel.
      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()