Class FmtBool

All Implemented Interfaces:
BoolCellProcessor, CellProcessor

public class FmtBool extends CellProcessorAdaptor implements BoolCellProcessor
Converts a Boolean into a formatted string. If you want to convert from a String to a Boolean, use the ParseBool processor.
Since:
1.50
  • Field Details

    • trueValue

      private final String trueValue
    • falseValue

      private final String falseValue
  • Constructor Details

    • FmtBool

      public FmtBool(String trueValue, String falseValue)
      Constructs a new FmtBool processor, which converts a Boolean into a formatted string.
      Parameters:
      trueValue - the String to use if the value is true
      falseValue - the String to use if the value is false
    • FmtBool

      public FmtBool(String trueValue, String falseValue, StringCellProcessor next)
      Constructs a new FmtBool processor, which converts a Boolean into a formatted string, then calls the next processor in the chain.
      Parameters:
      trueValue - the String to use if the value is true
      falseValue - the String to use if the value is false
      next - the next processor in the chain
      Throws:
      NullPointerException - if next is null
  • Method Details

    • execute

      public Object execute(Object value, CsvContext context)
      This method is invoked by the framework when the processor needs to process data or check constraints.
      Specified by:
      execute in interface CellProcessor
      Parameters:
      value - the value to be processed
      context - the CSV context
      Returns:
      the result of cell processor execution
      Throws:
      SuperCsvCellProcessorException - if value is null or is not a Boolean