Class SingleValueTranslator

java.lang.Object
de.hybris.platform.impex.jalo.translators.AbstractValueTranslator
de.hybris.platform.impex.jalo.translators.SingleValueTranslator
Direct Known Subclasses:
ActiveDirectoryGroupCollectionTranslator.PrincipalGroupTranslator, AnonymousUserTranslator, AtomicValueTranslator, CampaignSourceRulesTranslator, ClassificationAttributeValueTranslator, DiscountValueTranslator, EClassAttributeTypeTranslator, EClassUnitTranslator, ETIMAttributeTypeTranslator, Europe1RowTranslator, ExtractUserGroupTranslator.UserGroupTranslator, ItemExpressionTranslator, ItemPKTranslator, ProductFeatureValueTranslator, ProfiClassAttributeTypeTranslator, PromotionPriceRowsTranslator.PriceRowTranslator, TaxValueTranslator

public abstract class SingleValueTranslator extends AbstractValueTranslator
Base class of all translator translating single attribute values.
  • Constructor Details

    • SingleValueTranslator

      public SingleValueTranslator()
  • Method Details

    • isEmpty

      protected boolean isEmpty(String expr)
      Checks whether an expression is empty.
      Parameters:
      expr - expression to check
      Returns:
      true if it is recognized as empty, false otherwise
    • getEmptyValue

      protected Object getEmptyValue()
      The representation of an empty value this translator uses.
      Returns:
      used null value
    • importValue

      public final Object importValue(String valueExpr, Item toItem) throws JaloInvalidParameterException
      Description copied from class: AbstractValueTranslator
      Translates a tokenized csv value for import usage. This means that the result object must be a instance of the expected attribute type.
      Specified by:
      importValue in class AbstractValueTranslator
      Parameters:
      valueExpr - expression to translate
      toItem - the target item in case it already exist, null otherwise (for partOf attributes!)
      Returns:
      Object translated value
      Throws:
      JaloInvalidParameterException - value can not be translated with this translator or is invalid
    • exportValue

      public final String exportValue(Object value) throws JaloInvalidParameterException
      Description copied from class: AbstractValueTranslator
      Translates an attribute value for export usage. This means the attribute value must be transformed into a string which should be re-importable again.
      Specified by:
      exportValue in class AbstractValueTranslator
      Parameters:
      value - value to translate
      Returns:
      String translated value
      Throws:
      JaloInvalidParameterException - value can not be translated with this translator or is invalid
    • convertToJalo

      protected abstract Object convertToJalo(String expr, Item forItem)
      Converts a non-null and non-empty string into a jalo attribute value.
      Parameters:
      expr - string to translate
      forItem - item instance the translated value will be set to as attribute
      Returns:
      Object translated value
    • convertToString

      protected abstract String convertToString(Object value)
      Converts a non-null jalo attribute value into its string representation.
      Parameters:
      value - value to translate
      Returns:
      translated value