Class ParseDuration

  • All Implemented Interfaces:
    CellProcessor

    public class ParseDuration
    extends CellProcessorAdaptor
    Converts a String to a Duration. The String should be in the ISO 8601 duration format as defined in Duration.parse(CharSequence) For example, "PT1M12.345S" represents 1 minute, 12 seconds and 345 milliseconds.
    Since:
    2.4.0
    • Constructor Summary

      Constructors 
      Constructor Description
      ParseDuration()
      Constructs a new ParseDuration processor, which parses a String as a Duration.
      ParseDuration​(CellProcessor next)
      Constructs a new ParseDuration processor, which parses a String as a Duration, 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

      • ParseDuration

        public ParseDuration()
        Constructs a new ParseDuration processor, which parses a String as a Duration.
      • ParseDuration

        public ParseDuration​(CellProcessor next)
        Constructs a new ParseDuration processor, which parses a String as a Duration, then calls the next processor in the chain.
        Parameters:
        next - the next processor in the chain
    • 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 is not a String