Interface ExportSpecification


  • public interface ExportSpecification
    Describes how an ExportProcessor can handle a particular export.

    Example usage:

     public class EntityExportSpecification implements ExportSpecification {
    
         @Getter
         private final LinkedHashMap fieldConfigMap = new LinkedHashMap<>();
    
         public EntityExportSpecification() {
             initSpecification();
         }
    
         @Override
         public void initSpecification() {
             getFieldConfigMap().put("email", "Email");
         }
    
         @Override
         public boolean canModifyBeanSerializer(Class beanClass) {
             return Entity.class.isAssignableFrom(beanClass);
         }
     }
     
    Author:
    Vitalii Voronkov (vvoronkov)
    • Method Detail

      • initSpecification

        void initSpecification()
        This the main method to initialize this specification. Usually, it should be called from the main constructor.

        Example usage:

             ...
             public EntityExportSpecification() {
                 initSpecification();
             }
        
             @Override
             public void initSpecification() {
                 getFieldConfigMap().put("email", "Email");
             }
             ...
         
      • getFieldConfigMap

        LinkedHashMap<String,​String> getFieldConfigMap()
        Maintains a Map of String objects, that will be used to process the rows to an export file.

        The key of the Map should be a String representing the corresponding field name in business object.

        The value of the Map should be a String representing the corresponding header name in the exported file.

        Returns:
        the configuration map
      • canModifyBeanSerializer

        boolean canModifyBeanSerializer​(Class<?> beanClass)
        Determine whether or not this specification can be used to modify the bean serializer.
        Parameters:
        beanClass - the class of the bean to modify
        Returns:
        true if this specification can be used to modify the bean with the specified class
        See Also:
        BeanDescription.getBeanClass(), BeanSerializerModifier, SpecificationPropertiesSerializerModifier
      • includeHeaders

        default boolean includeHeaders()
        Whether or not include the header in the exported file.
        Returns:
        true to include the headers and false otherwise