Class FmtPeriod

  • All Implemented Interfaces:
    CellProcessor

    public class FmtPeriod
    extends CellProcessorAdaptor
    Converts a Period to a String. Converts to a String in the ISO 8601 format, in the same way as Period.toString(). For example, "P6Y3M7D" represents 6 years, 3 months, 7 days.
    Since:
    2.4.0
    • Constructor Summary

      Constructors 
      Constructor Description
      FmtPeriod()
      Constructs a new FmtPeriod processor, which formats a Period as a String.
      FmtPeriod​(CellProcessor next)
      Constructs a new FmtPeriod processor, which formats a Period as a String, then calls the next processor in the chain.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.Object execute​(java.lang.Object value, CsvContext context)
      This method is invoked by the framework when the processor needs to process data or check constraints.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • FmtPeriod

        public FmtPeriod()
        Constructs a new FmtPeriod processor, which formats a Period as a String.
      • FmtPeriod

        public FmtPeriod​(CellProcessor next)
        Constructs a new FmtPeriod processor, which formats a Period as a String, then calls the next processor in the chain.
        Parameters:
        next - the next processor in the chain
        Throws:
        java.lang.NullPointerException - if formatter or next is null
    • Method Detail

      • execute

        public java.lang.Object execute​(java.lang.Object value,
                                        CsvContext context)
        This method is invoked by the framework when the processor needs to process data or check constraints.
        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 not a Period