Class ValueFormatTranslatorImpl

    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected java.text.DecimalFormat createFormatterForService()  
      protected java.text.DecimalFormat createFormatterForUI​(java.util.Locale locale)  
      java.lang.String format​(CsticModel cstic, java.lang.String value)
      Converts a characteristic value into an external format suitable for UI-Display.
      java.lang.String formatDate​(java.util.Date date)
      Format date value from service to UI
      java.lang.String formatNumeric​(java.lang.String value)
      Formats numerical value from service to UI
      I18NService getI18NService()  
      protected java.util.Locale getLocale()  
      protected static java.text.DecimalFormat initialValue()  
      boolean isNumericCsticType​(CsticModel model)
      Checks the characteristic model whether it is either of type float or integer
      java.lang.String parse​(UiType uiType, java.lang.String value)
      Converts a characteristic value into an internal format, which is used by the underlying API's.
      java.lang.String parseNumeric​(java.lang.String value)
      Parses numerical value from UI to service
      void setI18NService​(I18NService i18nService)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ValueFormatTranslatorImpl

        public ValueFormatTranslatorImpl()
    • Method Detail

      • initialValue

        protected static java.text.DecimalFormat initialValue()
      • parse

        public java.lang.String parse​(UiType uiType,
                                      java.lang.String value)
        Description copied from interface: ValueFormatTranslator
        Converts a characteristic value into an internal format, which is used by the underlying API's.
        Specified by:
        parse in interface ValueFormatTranslator
        Parameters:
        uiType - UI type the characteristic value belongs to
        value - characteristic value in external format
        Returns:
        characteristic value in internal format
      • parseNumeric

        public java.lang.String parseNumeric​(java.lang.String value)
        Description copied from interface: ValueFormatTranslator
        Parses numerical value from UI to service
        Specified by:
        parseNumeric in interface ValueFormatTranslator
        Parameters:
        value - value to be parsed
        Returns:
        formatted numerical value
      • formatNumeric

        public java.lang.String formatNumeric​(java.lang.String value)
        Description copied from interface: ValueFormatTranslator
        Formats numerical value from service to UI
        Specified by:
        formatNumeric in interface ValueFormatTranslator
        Parameters:
        value - value to be parsed
        Returns:
        formatted numerical value
      • formatDate

        public java.lang.String formatDate​(java.util.Date date)
        Description copied from interface: ValueFormatTranslator
        Format date value from service to UI
        Specified by:
        formatDate in interface ValueFormatTranslator
        Parameters:
        date - Date value which should be formatted
        Returns:
        the formatted date value
      • getLocale

        protected java.util.Locale getLocale()
      • createFormatterForUI

        protected java.text.DecimalFormat createFormatterForUI​(java.util.Locale locale)
      • createFormatterForService

        protected java.text.DecimalFormat createFormatterForService()
      • format

        public java.lang.String format​(CsticModel cstic,
                                       java.lang.String value)
        Description copied from interface: ValueFormatTranslator
        Converts a characteristic value into an external format suitable for UI-Display.
        Specified by:
        format in interface ValueFormatTranslator
        Parameters:
        cstic - characteristic the value belongs to
        value - characteristic value in internal format
        Returns:
        characteristic value in external format
      • isNumericCsticType

        public boolean isNumericCsticType​(CsticModel model)
        Description copied from interface: ValueFormatTranslator
        Checks the characteristic model whether it is either of type float or integer
        Specified by:
        isNumericCsticType in interface ValueFormatTranslator
        Parameters:
        model - characteristic to be checked
        Returns:
        true if characteristic is numeric
      • setI18NService

        public void setI18NService​(I18NService i18nService)
        Parameters:
        i18nService - the i18NService to set
      • getI18NService

        public I18NService getI18NService()
        Returns:
        the i18NService