Class AtomicValueTranslator
- java.lang.Object
-
- de.hybris.platform.impex.jalo.translators.AbstractValueTranslator
-
- de.hybris.platform.impex.jalo.translators.SingleValueTranslator
-
- de.hybris.platform.impex.jalo.translators.AtomicValueTranslator
-
- Direct Known Subclasses:
DocumentIDTranslator
public class AtomicValueTranslator extends SingleValueTranslator
-
-
Constructor Summary
Constructors Constructor Description AtomicValueTranslator(AttributeDescriptor attributeDescriptor, java.lang.Class javaClass)AtomicValueTranslator(java.lang.Class javaClass)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.lang.ObjectconvertToJalo(java.lang.String valueExpr, Item forItem)Converts a non-null and non-empty string into a jalo attribute value.protected java.lang.StringconvertToString(java.lang.Object value)Converts a non-null jalo attribute value into its string representation.protected AttributeDescriptorgetAttributeDescriptor()Returns the assigned AttributeDescriptor.protected java.text.DateFormatgetDateFormat()Returns the DateFormat or a default one.protected java.lang.StringgetDateFormatString(AbstractDescriptor columnDescriptor)java.text.DateFormatgetDefaultDateFormat()Returns a default DateFormat with the default formating and the default locale.java.text.NumberFormatgetDefaultNumberFormat()Returns a default NumberFormat instance constructed with configured locale orLocale.Germanas default.protected java.text.NumberFormatgetNumberFormat()Returns the NumberFormat or a default one.protected java.lang.StringgetNumberFormatString(AbstractDescriptor columnDescriptor)protected booleanholdsUnresolvableItems(java.lang.Object object)voidinit(StandardColumnDescriptor columnDescriptor)Called once per header creation to allow configuring this translator using column modifiers etc.protected booleanisSupportedClass(java.lang.Class myClass)voidsetDateFormat(java.lang.String format)voidsetDateFormat(java.text.DateFormat format)Sets the date format used for date translation.voidsetLocale(java.util.Locale locale)Sets the locale used for default formats to another one (default is session locale).voidsetNumberFormat(java.lang.String format)voidsetNumberFormat(java.text.NumberFormat format)Sets the number format used for number translation.voidvalidate(StandardColumnDescriptor columnDescriptor)Validates the value translator once per header creation.-
Methods inherited from class de.hybris.platform.impex.jalo.translators.SingleValueTranslator
exportValue, getEmptyValue, importValue, isEmpty
-
Methods inherited from class de.hybris.platform.impex.jalo.translators.AbstractValueTranslator
clearStatus, createTranslator, createTranslator, createTranslator, debug, error, getColumnDescriptor, getFlexibleSearch, info, isDebugEnabled, isInfoEnabled, setEmpty, setError, warn, wasEmpty, wasUnresolved
-
-
-
-
Constructor Detail
-
AtomicValueTranslator
public AtomicValueTranslator(java.lang.Class javaClass)
-
AtomicValueTranslator
public AtomicValueTranslator(AttributeDescriptor attributeDescriptor, java.lang.Class javaClass)
-
-
Method Detail
-
setLocale
public void setLocale(java.util.Locale locale)
Sets the locale used for default formats to another one (default is session locale).- Parameters:
locale- locale to use for value translation with default formats
-
setDateFormat
public void setDateFormat(java.text.DateFormat format)
Sets the date format used for date translation. If set to null the default format will be used (seegetDefaultDateFormat()).- Parameters:
format- date format to use for date translation
-
setDateFormat
public void setDateFormat(java.lang.String format)
-
setNumberFormat
public void setNumberFormat(java.text.NumberFormat format)
Sets the number format used for number translation. If set to null the default format will be used (seegetDefaultNumberFormat()).- Parameters:
format- number format to use for number translation
-
setNumberFormat
public void setNumberFormat(java.lang.String format)
-
getAttributeDescriptor
protected AttributeDescriptor getAttributeDescriptor()
Returns the assigned AttributeDescriptor.- Returns:
- the assigned attributeDescriptor, which could be
null!!
-
getDateFormatString
protected java.lang.String getDateFormatString(AbstractDescriptor columnDescriptor)
-
getNumberFormatString
protected java.lang.String getNumberFormatString(AbstractDescriptor columnDescriptor)
-
getDateFormat
protected java.text.DateFormat getDateFormat()
Returns the DateFormat or a default one.- Returns:
- DateFormat
-
getNumberFormat
protected java.text.NumberFormat getNumberFormat()
Returns the NumberFormat or a default one.- Returns:
- NumberFormat
-
getDefaultNumberFormat
public java.text.NumberFormat getDefaultNumberFormat()
Returns a default NumberFormat instance constructed with configured locale orLocale.Germanas default.- Returns:
- NumberFormat
-
getDefaultDateFormat
public java.text.DateFormat getDefaultDateFormat()
Returns a default DateFormat with the default formating and the default locale.- Returns:
- DateFormat
-
init
public void init(StandardColumnDescriptor columnDescriptor)
Description copied from class:AbstractValueTranslatorCalled once per header creation to allow configuring this translator using column modifiers etc.- Overrides:
initin classAbstractValueTranslator- Parameters:
columnDescriptor- descriptor where the value to translate belongs to
-
validate
public void validate(StandardColumnDescriptor columnDescriptor) throws HeaderValidationException
Description copied from class:AbstractValueTranslatorValidates the value translator once per header creation.- Overrides:
validatein classAbstractValueTranslator- Parameters:
columnDescriptor- descriptor where the value to translate belongs to- Throws:
HeaderValidationException- validation has thrown errors
-
isSupportedClass
protected boolean isSupportedClass(java.lang.Class myClass)
-
convertToString
protected java.lang.String convertToString(java.lang.Object value)
Description copied from class:SingleValueTranslatorConverts a non-null jalo attribute value into its string representation.- Specified by:
convertToStringin classSingleValueTranslator- Parameters:
value- value to translate- Returns:
- translated value
-
convertToJalo
protected java.lang.Object convertToJalo(java.lang.String valueExpr, Item forItem)Description copied from class:SingleValueTranslatorConverts a non-null and non-empty string into a jalo attribute value.- Specified by:
convertToJaloin classSingleValueTranslator- Parameters:
valueExpr- string to translateforItem- item instance the translated value will be set to as attribute- Returns:
- Object translated value
-
holdsUnresolvableItems
protected boolean holdsUnresolvableItems(java.lang.Object object)
-
-