Class DefaultCommonI18NService

    • Constructor Detail

      • DefaultCommonI18NService

        public DefaultCommonI18NService()
    • Method Detail

      • setConversionStrategy

        public void setConversionStrategy​(ConversionStrategy conversionStrategy)
      • getLocaleForLanguage

        public java.util.Locale getLocaleForLanguage​(LanguageModel languageModel)
        Description copied from interface: CommonI18NService
        Returns a Locale according language (ISO code), country (ISO code) and vendor id. The three parameters are passed as a isocode of the LanguageModel instance. Supported delimiters are: _ , . ;

        LanguageModel languageModel = new LanguageModel();
        languageModel.setIsocode("de_DE_WIN");
        getLocaleForLanguage(languageModel);
        languageModel.setIsocode("en,AT,");
        getLocaleForLanguage(languageModel);

        Specified by:
        getLocaleForLanguage in interface CommonI18NService
      • getLanguage

        public LanguageModel getLanguage​(java.lang.String isocode)
        Description copied from interface: CommonI18NService
        Gets the language for the given isocode.
        Specified by:
        getLanguage in interface CommonI18NService
        Parameters:
        isocode - the isocode a language is searched for
        Returns:
        language for searched isocode
      • getRegion

        public RegionModel getRegion​(CountryModel country,
                                     java.lang.String code)
        Description copied from interface: CommonI18NService
        Returns a region by its isocode within the country.
        Specified by:
        getRegion in interface CommonI18NService
        Parameters:
        country - the country model
        code - the region code
        Returns:
        the region
      • convertAndRoundCurrency

        public double convertAndRoundCurrency​(double sourceFactor,
                                              double targetFactor,
                                              int digits,
                                              double value)
        Description copied from interface: CommonI18NService
        Converts a (price) value of this currency into a value for the specified target currency and rounds the result according to the target currency's digits.
        Specified by:
        convertAndRoundCurrency in interface CommonI18NService
        Parameters:
        sourceFactor - the conversionFactor of the source currency
        targetFactor - the conversionFactor of the target currency
        digits - currency's number of digits
        value - the value which should be converted
        Returns:
        the converted and rounded value
      • roundCurrency

        public double roundCurrency​(double value,
                                    int digits)
        Description copied from interface: CommonI18NService
        Rounds a price value according to this currency's number of digits.
        Specified by:
        roundCurrency in interface CommonI18NService
        Parameters:
        value - the currency value which should be rounded.
        digits - currency's number of digits
        Returns:
        the rounded currency value
      • setLanguageDao

        public void setLanguageDao​(LanguageDao dao)
      • setCountryDao

        public void setCountryDao​(CountryDao countryDao)
      • setCurrencyDao

        public void setCurrencyDao​(CurrencyDao currencyDao)
      • setRegionDao

        public void setRegionDao​(RegionDao regionDao)