Class ValueFormatTranslatorImpl
- java.lang.Object
-
- de.hybris.platform.sap.productconfig.facades.impl.ValueFormatTranslatorImpl
-
- All Implemented Interfaces:
ValueFormatTranslator
public class ValueFormatTranslatorImpl extends java.lang.Object implements ValueFormatTranslator
Default implementation of theValueFormatTranslator
.
-
-
Constructor Summary
Constructors Constructor Description 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 UIjava.lang.String
formatNumeric(java.lang.String value)
Formats numerical value from service to UII18NService
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 integerjava.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 servicevoid
setI18NService(I18NService i18nService)
-
-
-
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 interfaceValueFormatTranslator
- Parameters:
uiType
- UI type the characteristic value belongs tovalue
- 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 interfaceValueFormatTranslator
- 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 interfaceValueFormatTranslator
- 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 interfaceValueFormatTranslator
- 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 interfaceValueFormatTranslator
- Parameters:
cstic
- characteristic the value belongs tovalue
- 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 interfaceValueFormatTranslator
- 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
-
-