Class ExcelTranslatorRegistry

java.lang.Object
com.hybris.backoffice.excel.translators.ExcelTranslatorRegistry

public class ExcelTranslatorRegistry extends Object
Default registry for excel translator strategies.
  • Constructor Details

    • ExcelTranslatorRegistry

      public ExcelTranslatorRegistry()
  • Method Details

    • getTranslator

      public Optional<ExcelValueTranslator<Object>> getTranslator(AttributeDescriptorModel attributeDescriptor)
      Finds translator which can handle given attribute descriptor. This method is Recommended during importing excel file.
      Parameters:
      attributeDescriptor - which represents selected attribute.
      Returns:
      Optional of ExcelValueTranslator. If none translator can handle given attribute descriptor then Optional.empty() will be returned.
    • getTranslator

      public Optional<ExcelValueTranslator<Object>> getTranslator(AttributeDescriptorModel attributeDescriptor, ItemModel itemModel)
      Finds translator which can handle given attribute descriptor. This method is Recommended during exporting. During importing excel file, the itemModel will be always null, because the item will be created by impex.
      Parameters:
      attributeDescriptor - which represents selected attribute.
      itemModel - instance of exporting model
      Returns:
      Optional of ExcelValueTranslator. If none translator can handle given attribute descriptor then Optional.empty() will be returned.
    • getTranslator

      public Optional<ExcelValueTranslator<Object>> getTranslator(AttributeDescriptorModel attributeDescriptor, Class<? extends ExcelValueTranslator>... exclude)
      Finds translator which can handle given attribute descriptor.
      Parameters:
      attributeDescriptor - which represents selected attribute.
      exclude - translators classes which should not be taken into account
      Returns:
      Optional of ExcelValueTranslator<Object>. If none translator can handle given attribute descriptor then Optional.empty() will be returned.
    • getTranslatorClass

      protected Class<? extends ExcelValueTranslator> getTranslatorClass(ExcelValueTranslator<Object> translator)
    • init

      @Deprecated(since="1811", forRemoval=true) @PostConstruct public void init()
      Deprecated, for removal: This API element is subject to removal in a future version.
      since 1811 use method getTranslators() which return sorted translators
      Post construct method which sorts translators by its order. The method shouldn't be invoked manually.
    • canHandle

      public boolean canHandle(AttributeDescriptorModel attributeDescriptor)
      Indicates whether there is at least one translator which can handle given attribute descriptor.
      Parameters:
      attributeDescriptor - which represents selected attribute.
      Returns:
      boolean whether at least one translator can handler given attribute descriptor.
    • getTranslators

      public List<ExcelValueTranslator<Object>> getTranslators()
      Returns list of registered translators.
      Returns:
      list of registered translators.
    • setTranslators

      public void setTranslators(List<ExcelValueTranslator<Object>> translators)
      Sets list of translators for the registry.
      Parameters:
      translators - for the registry.