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.DecimalFormatcreateFormatterForService()protected java.text.DecimalFormatcreateFormatterForUI(java.util.Locale locale)java.lang.Stringformat(CsticModel cstic, java.lang.String value)Converts a characteristic value into an external format suitable for UI-Display.java.lang.StringformatDate(java.util.Date date)Format date value from service to UIjava.lang.StringformatNumeric(java.lang.String value)Formats numerical value from service to UII18NServicegetI18NService()protected java.util.LocalegetLocale()protected static java.text.DecimalFormatinitialValue()booleanisNumericCsticType(CsticModel model)Checks the characteristic model whether it is either of type float or integerjava.lang.Stringparse(UiType uiType, java.lang.String value)Converts a characteristic value into an internal format, which is used by the underlying API's.java.lang.StringparseNumeric(java.lang.String value)Parses numerical value from UI to servicevoidsetI18NService(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:ValueFormatTranslatorConverts a characteristic value into an internal format, which is used by the underlying API's.- Specified by:
parsein 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:ValueFormatTranslatorParses numerical value from UI to service- Specified by:
parseNumericin 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:ValueFormatTranslatorFormats numerical value from service to UI- Specified by:
formatNumericin 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:ValueFormatTranslatorFormat date value from service to UI- Specified by:
formatDatein 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:ValueFormatTranslatorConverts a characteristic value into an external format suitable for UI-Display.- Specified by:
formatin 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:ValueFormatTranslatorChecks the characteristic model whether it is either of type float or integer- Specified by:
isNumericCsticTypein 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
-
-