Class ExcelTranslatorRegistry
- java.lang.Object
-
- com.hybris.backoffice.excel.translators.ExcelTranslatorRegistry
-
public class ExcelTranslatorRegistry extends java.lang.ObjectDefault registry for excel translator strategies.
-
-
Constructor Summary
Constructors Constructor Description ExcelTranslatorRegistry()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description booleancanHandle(AttributeDescriptorModel attributeDescriptor)Indicates whether there is at least one translator which can handle given attribute descriptor.java.util.Optional<ExcelValueTranslator<java.lang.Object>>getTranslator(AttributeDescriptorModel attributeDescriptor)Finds translator which can handle given attribute descriptor.java.util.Optional<ExcelValueTranslator<java.lang.Object>>getTranslator(AttributeDescriptorModel attributeDescriptor, ItemModel itemModel)Finds translator which can handle given attribute descriptor.java.util.Optional<ExcelValueTranslator<java.lang.Object>>getTranslator(AttributeDescriptorModel attributeDescriptor, java.lang.Class<? extends ExcelValueTranslator>... exclude)Finds translator which can handle given attribute descriptor.protected java.lang.Class<? extends ExcelValueTranslator>getTranslatorClass(ExcelValueTranslator<java.lang.Object> translator)java.util.List<ExcelValueTranslator<java.lang.Object>>getTranslators()Returns list of registered translators.voidinit()Deprecated, for removal: This API element is subject to removal in a future version.since 1811 use methodgetTranslators()which return sorted translatorsvoidsetTranslators(java.util.List<ExcelValueTranslator<java.lang.Object>> translators)Sets list of translators for the registry.
-
-
-
Method Detail
-
getTranslator
public java.util.Optional<ExcelValueTranslator<java.lang.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 thenOptional.empty()will be returned.
-
getTranslator
public java.util.Optional<ExcelValueTranslator<java.lang.Object>> getTranslator(AttributeDescriptorModel attributeDescriptor, ItemModel itemModel)
Finds translator which can handle given attribute descriptor. This method is Recommended during exporting. During importing excel file, theitemModelwill 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 thenOptional.empty()will be returned.
-
getTranslator
public java.util.Optional<ExcelValueTranslator<java.lang.Object>> getTranslator(AttributeDescriptorModel attributeDescriptor, java.lang.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. If none translator can handle given attribute descriptor thenOptional.empty()will be returned.
-
getTranslatorClass
protected java.lang.Class<? extends ExcelValueTranslator> getTranslatorClass(ExcelValueTranslator<java.lang.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 methodgetTranslators()which return sorted translatorsPost 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 java.util.List<ExcelValueTranslator<java.lang.Object>> getTranslators()
Returns list of registered translators.- Returns:
- list of registered translators.
-
setTranslators
public void setTranslators(java.util.List<ExcelValueTranslator<java.lang.Object>> translators)
Sets list of translators for the registry.- Parameters:
translators- for the registry.
-
-