Class ExcelTranslatorRegistry
java.lang.Object
com.hybris.backoffice.excel.translators.ExcelTranslatorRegistry
Default registry for excel translator strategies.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleancanHandle(AttributeDescriptorModel attributeDescriptor) Indicates whether there is at least one translator which can handle given attribute descriptor.getTranslator(AttributeDescriptorModel attributeDescriptor) Finds translator which can handle given attribute descriptor.getTranslator(AttributeDescriptorModel attributeDescriptor, ItemModel itemModel) Finds translator which can handle given attribute descriptor.getTranslator(AttributeDescriptorModel attributeDescriptor, Class<? extends ExcelValueTranslator>... exclude) Finds translator which can handle given attribute descriptor.protected Class<? extends ExcelValueTranslator>getTranslatorClass(ExcelValueTranslator<Object> translator) Returns list of registered translators.voidinit()Deprecated, for removal: This API element is subject to removal in a future version.voidsetTranslators(List<ExcelValueTranslator<Object>> translators) Sets list of translators for the registry.
-
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 thenOptional.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, 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 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 thenOptional.empty()will be returned.
-
getTranslatorClass
protected Class<? extends ExcelValueTranslator> getTranslatorClass(ExcelValueTranslator<Object> translator) -
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
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
Returns list of registered translators.- Returns:
- list of registered translators.
-
setTranslators
Sets list of translators for the registry.- Parameters:
translators- for the registry.
-
getTranslators()which return sorted translators