Package org.supercsv.cellprocessor.time
Class AbstractTemporalAccessorParsingProcessor<T extends TemporalAccessor>
java.lang.Object
org.supercsv.cellprocessor.CellProcessorAdaptor
org.supercsv.cellprocessor.time.AbstractTemporalAccessorParsingProcessor<T>
- Type Parameters:
T
- theTemporalAccessor
type that the processor returns
- All Implemented Interfaces:
CellProcessor
,StringCellProcessor
- Direct Known Subclasses:
ParseLocalDate
,ParseLocalDateTime
,ParseLocalTime
,ParseZonedDateTime
public abstract class AbstractTemporalAccessorParsingProcessor<T extends TemporalAccessor>
extends CellProcessorAdaptor
implements StringCellProcessor
Abstract base class for cell processors converting Strings to
TemporalAccessor
types.- Since:
- 2.4.0
-
Field Summary
FieldsFields inherited from class org.supercsv.cellprocessor.CellProcessorAdaptor
next
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs a new AbstractTemporalAccessorParsingProcessor processor, which parses a String as aTemporalAccessor
type.Constructs a new AbstractTemporalAccessorParsingProcessor processor, which parses a String as aTemporalAccessor
type using the supplied formatter.AbstractTemporalAccessorParsingProcessor
(DateTimeFormatter formatter, CellProcessor next) Constructs a new AbstractTemporalAccessorParsingProcessor processor, which parses a String as aTemporalAccessor
type using the supplied formatter, then calls the next processor in the chain.Constructs a new AbstractTemporalAccessorParsingProcessor processor, which parses a String as aTemporalAccessor
type, then calls the next processor in the chain. -
Method Summary
Modifier and TypeMethodDescriptionprivate static void
checkPreconditions
(DateTimeFormatter formatter) Checks the preconditions for creating a new AbstractTemporalAccessorParsingProcessor processor.execute
(Object value, CsvContext context) This method is invoked by the framework when the processor needs to process data or check constraints.protected abstract T
Parses the String into the appropriateTemporalAccessor
type.protected abstract T
parse
(String string, DateTimeFormatter formatter) Parses the String into the appropriateTemporalAccessor
type, using the supplied formatter.Methods inherited from class org.supercsv.cellprocessor.CellProcessorAdaptor
toString, validateInputNotNull
-
Field Details
-
formatter
-
-
Constructor Details
-
AbstractTemporalAccessorParsingProcessor
public AbstractTemporalAccessorParsingProcessor()Constructs a new AbstractTemporalAccessorParsingProcessor processor, which parses a String as aTemporalAccessor
type. -
AbstractTemporalAccessorParsingProcessor
Constructs a new AbstractTemporalAccessorParsingProcessor processor, which parses a String as aTemporalAccessor
type, then calls the next processor in the chain.- Parameters:
next
- the next processor in the chain- Throws:
NullPointerException
- if next is null
-
AbstractTemporalAccessorParsingProcessor
Constructs a new AbstractTemporalAccessorParsingProcessor processor, which parses a String as aTemporalAccessor
type using the supplied formatter.- Parameters:
formatter
- the formatter used for parsing- Throws:
NullPointerException
- if formatter is null
-
AbstractTemporalAccessorParsingProcessor
Constructs a new AbstractTemporalAccessorParsingProcessor processor, which parses a String as aTemporalAccessor
type using the supplied formatter, then calls the next processor in the chain.- Parameters:
formatter
- the formatter used for parsingnext
- the next processor in the chain- Throws:
NullPointerException
- if formatter or next is null
-
-
Method Details
-
checkPreconditions
Checks the preconditions for creating a new AbstractTemporalAccessorParsingProcessor processor.- Parameters:
formatter
- the formatter- Throws:
NullPointerException
- if formatter is null
-
execute
This method is invoked by the framework when the processor needs to process data or check constraints.- Specified by:
execute
in interfaceCellProcessor
- Parameters:
value
- the value to be processedcontext
- the CSV context- Returns:
- the result of cell processor execution
- Throws:
SuperCsvCellProcessorException
- if value is null or is not a String
-
parse
Parses the String into the appropriateTemporalAccessor
type.- Parameters:
string
- the string to parse- Returns:
- the
TemporalAccessor
type - Throws:
IllegalArgumentException
- if the string can't be parsed
-
parse
Parses the String into the appropriateTemporalAccessor
type, using the supplied formatter.- Parameters:
string
- the string to parseformatter
- the formatter to use- Returns:
- the
TemporalAccessor
type - Throws:
IllegalArgumentException
- if the string can't be parsed
-