Class DefaultTmaPriceValueFormatter

    • 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)  
    • 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: 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 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 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 java.text.NumberFormat createNumberFormat​(java.util.Locale locale,
                                                            CurrencyModel currency)
      • adjustDigits

        protected java.text.DecimalFormat adjustDigits​(java.text.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 java.text.DecimalFormat adjustSymbol​(java.text.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()