Class AbstractTemporalAccessorParsingProcessor<T extends java.time.temporal.TemporalAccessor>

    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.time.format.DateTimeFormatter formatter  
    • Constructor Summary

      Constructors 
      Constructor Description
      AbstractTemporalAccessorParsingProcessor()
      Constructs a new AbstractTemporalAccessorParsingProcessor processor, which parses a String as a TemporalAccessor type.
      AbstractTemporalAccessorParsingProcessor​(java.time.format.DateTimeFormatter formatter)
      Constructs a new AbstractTemporalAccessorParsingProcessor processor, which parses a String as a TemporalAccessor type using the supplied formatter.
      AbstractTemporalAccessorParsingProcessor​(java.time.format.DateTimeFormatter formatter, CellProcessor next)
      Constructs a new AbstractTemporalAccessorParsingProcessor processor, which parses a String as a TemporalAccessor type using the supplied formatter, then calls the next processor in the chain.
      AbstractTemporalAccessorParsingProcessor​(CellProcessor next)
      Constructs a new AbstractTemporalAccessorParsingProcessor processor, which parses a String as a TemporalAccessor type, then calls the next processor in the chain.
    • Method Summary

      All Methods Static Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      private static void checkPreconditions​(java.time.format.DateTimeFormatter formatter)
      Checks the preconditions for creating a new AbstractTemporalAccessorParsingProcessor processor.
      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.
      protected abstract T parse​(java.lang.String string)
      Parses the String into the appropriate TemporalAccessor type.
      protected abstract T parse​(java.lang.String string, java.time.format.DateTimeFormatter formatter)
      Parses the String into the appropriate TemporalAccessor type, using the supplied formatter.
      • Methods inherited from class java.lang.Object

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

      • formatter

        private final java.time.format.DateTimeFormatter formatter
    • Constructor Detail

      • AbstractTemporalAccessorParsingProcessor

        public AbstractTemporalAccessorParsingProcessor()
        Constructs a new AbstractTemporalAccessorParsingProcessor processor, which parses a String as a TemporalAccessor type.
      • AbstractTemporalAccessorParsingProcessor

        public AbstractTemporalAccessorParsingProcessor​(CellProcessor next)
        Constructs a new AbstractTemporalAccessorParsingProcessor processor, which parses a String as a TemporalAccessor type, then calls the next processor in the chain.
        Parameters:
        next - the next processor in the chain
        Throws:
        java.lang.NullPointerException - if next is null
      • AbstractTemporalAccessorParsingProcessor

        public AbstractTemporalAccessorParsingProcessor​(java.time.format.DateTimeFormatter formatter)
        Constructs a new AbstractTemporalAccessorParsingProcessor processor, which parses a String as a TemporalAccessor type using the supplied formatter.
        Parameters:
        formatter - the formatter used for parsing
        Throws:
        java.lang.NullPointerException - if formatter is null
      • AbstractTemporalAccessorParsingProcessor

        public AbstractTemporalAccessorParsingProcessor​(java.time.format.DateTimeFormatter formatter,
                                                        CellProcessor next)
        Constructs a new AbstractTemporalAccessorParsingProcessor processor, which parses a String as a TemporalAccessor type using the supplied formatter, then calls the next processor in the chain.
        Parameters:
        formatter - the formatter used for parsing
        next - the next processor in the chain
        Throws:
        java.lang.NullPointerException - if formatter or next is null
    • Method Detail

      • checkPreconditions

        private static void checkPreconditions​(java.time.format.DateTimeFormatter formatter)
        Checks the preconditions for creating a new AbstractTemporalAccessorParsingProcessor processor.
        Parameters:
        formatter - the formatter
        Throws:
        java.lang.NullPointerException - if formatter is null
      • 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.
        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 String
      • parse

        protected abstract T parse​(java.lang.String string)
        Parses the String into the appropriate TemporalAccessor type.
        Parameters:
        string - the string to parse
        Returns:
        the TemporalAccessor type
        Throws:
        java.lang.IllegalArgumentException - if the string can't be parsed
      • parse

        protected abstract T parse​(java.lang.String string,
                                   java.time.format.DateTimeFormatter formatter)
        Parses the String into the appropriate TemporalAccessor type, using the supplied formatter.
        Parameters:
        string - the string to parse
        formatter - the formatter to use
        Returns:
        the TemporalAccessor type
        Throws:
        java.lang.IllegalArgumentException - if the string can't be parsed