Class ExcelAttributeTranslatorRegistry
java.lang.Object
com.hybris.backoffice.excel.translators.ExcelAttributeTranslatorRegistry
Default registry for excel attribute translator strategies.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleancanHandle(ExcelAttribute excelAttribute) Indicates whether there is at least one translator which can handle given attribute descriptor.findTranslator(ExcelAttribute excelAttribute) Finds translator which can handle given excel attribute.findTranslator(ExcelAttribute excelAttribute, Class<? extends ExcelAttributeTranslator>... exclude) Finds translator which can handle given excel attribute.protected Class<? extends ExcelAttributeTranslator>getTranslatorClass(ExcelAttributeTranslator<ExcelAttribute> translator) Returns list of registered attribute translators.voidinit()Post construct method which sorts translators by its order.voidsetTranslators(List<ExcelAttributeTranslator<ExcelAttribute>> translators) Sets list of attribute translators for the registry.
-
Constructor Details
-
ExcelAttributeTranslatorRegistry
public ExcelAttributeTranslatorRegistry()
-
-
Method Details
-
findTranslator
public Optional<ExcelAttributeTranslator<ExcelAttribute>> findTranslator(ExcelAttribute excelAttribute) Finds translator which can handle given excel attribute.- Parameters:
excelAttribute- which represents selected excel attribute.- Returns:
- Optional of
ExcelAttributeTranslator. If none translator can handle given attribute descriptor thenOptional.empty()will be returned.
-
findTranslator
public Optional<ExcelAttributeTranslator<ExcelAttribute>> findTranslator(ExcelAttribute excelAttribute, Class<? extends ExcelAttributeTranslator>... exclude) Finds translator which can handle given excel attribute.- Parameters:
excelAttribute- which represents selected excel attribute.exclude- translators classes which should not be taken into account- Returns:
- Optional of
ExcelAttributeTranslator<ExcelAttribute>. If none translator can handle given attribute descriptor thenOptional.empty()will be returned.
-
getTranslatorClass
protected Class<? extends ExcelAttributeTranslator> getTranslatorClass(ExcelAttributeTranslator<ExcelAttribute> translator) -
init
@PostConstruct public void init()Post 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:
excelAttribute- which represents selected attribute.- Returns:
- true whether at least one translator can handle given attribute descriptor.
-
getTranslators
Returns list of registered attribute translators.- Returns:
- list of registered translators.
-
setTranslators
Sets list of attribute translators for the registry.- Parameters:
translators- for the registry.
-