Class AbstractTemporalAccessorParsingProcessor<T extends TemporalAccessor>
java.lang.Object
org.supercsv.cellprocessor.CellProcessorAdaptor
org.supercsv.cellprocessor.time.AbstractTemporalAccessorParsingProcessor<T>
- Type Parameters:
T- theTemporalAccessortype 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 CellProcessorAdaptor
next -
Constructor Summary
ConstructorsConstructorDescriptionConstructs a new AbstractTemporalAccessorParsingProcessor processor, which parses a String as aTemporalAccessortype.Constructs a new AbstractTemporalAccessorParsingProcessor processor, which parses a String as aTemporalAccessortype using the supplied formatter.AbstractTemporalAccessorParsingProcessor(DateTimeFormatter formatter, CellProcessor next) Constructs a new AbstractTemporalAccessorParsingProcessor processor, which parses a String as aTemporalAccessortype using the supplied formatter, then calls the next processor in the chain.Constructs a new AbstractTemporalAccessorParsingProcessor processor, which parses a String as aTemporalAccessortype, then calls the next processor in the chain. -
Method Summary
Modifier and TypeMethodDescriptionprivate static voidcheckPreconditions(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 TParses the String into the appropriateTemporalAccessortype.protected abstract Tparse(String string, DateTimeFormatter formatter) Parses the String into the appropriateTemporalAccessortype, using the supplied formatter.Methods inherited from class CellProcessorAdaptor
toString, validateInputNotNull
-
Field Details
-
formatter
-
-
Constructor Details
-
AbstractTemporalAccessorParsingProcessor
public AbstractTemporalAccessorParsingProcessor()Constructs a new AbstractTemporalAccessorParsingProcessor processor, which parses a String as aTemporalAccessortype. -
AbstractTemporalAccessorParsingProcessor
Constructs a new AbstractTemporalAccessorParsingProcessor processor, which parses a String as aTemporalAccessortype, 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 aTemporalAccessortype 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 aTemporalAccessortype 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:
executein 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 appropriateTemporalAccessortype.- Parameters:
string- the string to parse- Returns:
- the
TemporalAccessortype - Throws:
IllegalArgumentException- if the string can't be parsed
-
parse
Parses the String into the appropriateTemporalAccessortype, using the supplied formatter.- Parameters:
string- the string to parseformatter- the formatter to use- Returns:
- the
TemporalAccessortype - Throws:
IllegalArgumentException- if the string can't be parsed
-