Class BaseCsvFieldWriter

Direct Known Subclasses:
CsvFieldWriter

public abstract class BaseCsvFieldWriter extends BaseImportFieldWriter
Encapsulates the functionality for custom setters that allow processing of CustomSetterValue
  • Field Details

    • ZERO_VALUE_ARRAY

      protected static final String[] ZERO_VALUE_ARRAY
  • Constructor Details

    • BaseCsvFieldWriter

      protected BaseCsvFieldWriter(Logger log, String dbColumnName, String arrayDelimiter)
  • Method Details

    • getSetterValue

      public CustomSetterValue<?> getSetterValue()
      The getter of the setter value.
      Returns:
      Returns the setter which should be populated with the final value for the column
    • initialize

      public void initialize(CustomSetterValue<?> setterValue, Map<String,String> importProperties)
      initializes given Setter and Import Properties
      Parameters:
      setterValue - the setter for this Column
      importProperties - The custom properties map passed in import method
    • getConstantColumnValue

      public String getConstantColumnValue()
      The getter to retrieve the constantColumnValue
      Returns:
      the Constant Column Value
    • setConstantColumnValue

      public void setConstantColumnValue(String constantColumnValue)
      The Constant Column Value as passed in from ui
      Parameters:
      constantColumnValue - The value that represents the ConstantColumnValue
    • processValues

      public List<CustomSetterValue<?>> processValues(@NotNull @NotNull Map<String,Object[]> columnNameToValueMap, int size, long destEnd) throws RowProcessingException
      The method is invoked by the CustomSetter Column Parser by incorporating the values from all dependent columns If dependent columns are not provided then the map would contain values from all the columns Note no change for Constant Column values they need to be retrieved using ImportFieldWriter.getConstantColumnValue(String)
      Parameters:
      columnNameToValueMap - The column name to corresponding CustomValue array map
      size - The size of the chunk, which is the same as the size of CustomSetterValue array in the map
      destEnd - The exclusive end index of the destination range.
      Returns:
      The processed custom setter column values for each row
      Throws:
      RowProcessingException - Thrown if processing errors occur when parsing to create Csv records
    • getSetterCopy

      protected CustomSetterValue<?> getSetterCopy()
      Returns a new CustomSetterValue instance that is a copy of the setter present in the FieldWriter instance.
      Returns:
      new instance of CustomSetterValue that is identical to the existing setter
    • processField

      public void processField(@NotNull @NotNull Map<String,Object> columnNameToValueMap)
      The method is invoked by the CustomSetter Column Parser by incorporating the values from all dependent columns If dependent columns are not provided then the map would contain values from all the columns Note no change for Constant Column values they need to be retrieved using ImportFieldWriter.getConstantColumnValue(String)
      Parameters:
      columnNameToValueMap - The column name to corresponding CustomValue array map