Class ExcelAttributeTranslatorRegistry
- java.lang.Object
-
- com.hybris.backoffice.excel.translators.ExcelAttributeTranslatorRegistry
-
public class ExcelAttributeTranslatorRegistry extends java.lang.ObjectDefault registry for excel attribute translator strategies.
-
-
Constructor Summary
Constructors Constructor Description ExcelAttributeTranslatorRegistry()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancanHandle(ExcelAttribute excelAttribute)Indicates whether there is at least one translator which can handle given attribute descriptor.java.util.Optional<ExcelAttributeTranslator<ExcelAttribute>>findTranslator(ExcelAttribute excelAttribute)Finds translator which can handle given excel attribute.java.util.Optional<ExcelAttributeTranslator<ExcelAttribute>>findTranslator(ExcelAttribute excelAttribute, java.lang.Class<? extends ExcelAttributeTranslator>... exclude)Finds translator which can handle given excel attribute.protected java.lang.Class<? extends ExcelAttributeTranslator>getTranslatorClass(ExcelAttributeTranslator<ExcelAttribute> translator)java.util.List<ExcelAttributeTranslator<ExcelAttribute>>getTranslators()Returns list of registered attribute translators.voidinit()Post construct method which sorts translators by its order.voidsetTranslators(java.util.List<ExcelAttributeTranslator<ExcelAttribute>> translators)Sets list of attribute translators for the registry.
-
-
-
Method Detail
-
findTranslator
public java.util.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 java.util.Optional<ExcelAttributeTranslator<ExcelAttribute>> findTranslator(ExcelAttribute excelAttribute, java.lang.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. If none translator can handle given attribute descriptor thenOptional.empty()will be returned.
-
getTranslatorClass
protected java.lang.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
public boolean canHandle(ExcelAttribute excelAttribute)
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
public java.util.List<ExcelAttributeTranslator<ExcelAttribute>> getTranslators()
Returns list of registered attribute translators.- Returns:
- list of registered translators.
-
setTranslators
public void setTranslators(java.util.List<ExcelAttributeTranslator<ExcelAttribute>> translators)
Sets list of attribute translators for the registry.- Parameters:
translators- for the registry.
-
-