Interface ValueFormatTranslator

  • All Known Implementing Classes:
    ValueFormatTranslatorImpl

    public interface ValueFormatTranslator
    Helper for formatting characteristic values. The external format for UI Display is derived from the web-shops I18N locale, which in turn depends on the browser's locale.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      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
      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
    • Method Detail

      • parse

        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.
        Parameters:
        uiType - UI type the characteristic value belongs to
        value - characteristic value in external format
        Returns:
        characteristic value in internal format
      • format

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

        boolean isNumericCsticType​(CsticModel model)
        Checks the characteristic model whether it is either of type float or integer
        Parameters:
        model - characteristic to be checked
        Returns:
        true if characteristic is numeric
      • parseNumeric

        java.lang.String parseNumeric​(java.lang.String value)
        Parses numerical value from UI to service
        Parameters:
        value - value to be parsed
        Returns:
        formatted numerical value
      • formatNumeric

        java.lang.String formatNumeric​(java.lang.String value)
        Formats numerical value from service to UI
        Parameters:
        value - value to be parsed
        Returns:
        formatted numerical value
      • formatDate

        java.lang.String formatDate​(java.util.Date date)
        Format date value from service to UI
        Parameters:
        date - Date value which should be formatted
        Returns:
        the formatted date value