Class ExcelTranslatorRegistry


  • public class ExcelTranslatorRegistry
    extends java.lang.Object
    Default registry for excel translator strategies.
    • Constructor Detail

      • ExcelTranslatorRegistry

        public ExcelTranslatorRegistry()
    • 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 then Optional.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, 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 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 then Optional.empty() will be returned.
      • 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 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.