Package org.supercsv.cellprocessor.time
Class ParseLocalDateTime
java.lang.Object
org.supercsv.cellprocessor.CellProcessorAdaptor
org.supercsv.cellprocessor.time.AbstractTemporalAccessorParsingProcessor<LocalDateTime>
org.supercsv.cellprocessor.time.ParseLocalDateTime
- All Implemented Interfaces:
CellProcessor,StringCellProcessor
Converts a String to a LocalDateTime.
For constructors using DateTimeFormatter, refer to the following
classes:
DateTimeFormatter- formats by pattern and styleDateTimeFormatter- ISO 8601 formatsDateTimeFormatterBuilder- complex formats created via method calls
- Since:
- 2.4.0
-
Field Summary
Fields inherited from class org.supercsv.cellprocessor.CellProcessorAdaptor
next -
Constructor Summary
ConstructorsConstructorDescriptionConstructs a new ParseLocalDateTime processor, which parses a String as a LocalDateTime, usingLocalDateTime.parse(CharSequence).ParseLocalDateTime(DateTimeFormatter formatter) Constructs a new ParseLocalDateTime processor, which parses a String as a LocalDateTime using the supplied formatter.ParseLocalDateTime(DateTimeFormatter formatter, CellProcessor next) Constructs a new ParseLocalDateTime processor, which parses a String as a LocalDateTime using the supplied formatter, then calls the next processor in the chain.Constructs a new ParseLocalDateTime processor, which parses a String as a LocalDateTime, then calls the next processor in the chain. -
Method Summary
Modifier and TypeMethodDescriptionprotected LocalDateTimeParses the String into the appropriateTemporalAccessortype.protected LocalDateTimeparse(String string, DateTimeFormatter formatter) Parses the String into the appropriateTemporalAccessortype, using the supplied formatter.Methods inherited from class org.supercsv.cellprocessor.time.AbstractTemporalAccessorParsingProcessor
executeMethods inherited from class org.supercsv.cellprocessor.CellProcessorAdaptor
toString, validateInputNotNull
-
Constructor Details
-
ParseLocalDateTime
public ParseLocalDateTime()Constructs a new ParseLocalDateTime processor, which parses a String as a LocalDateTime, usingLocalDateTime.parse(CharSequence). -
ParseLocalDateTime
Constructs a new ParseLocalDateTime processor, which parses a String as a LocalDateTime, then calls the next processor in the chain.- Parameters:
next- the next processor in the chain- Throws:
NullPointerException- if next is null
-
ParseLocalDateTime
Constructs a new ParseLocalDateTime processor, which parses a String as a LocalDateTime using the supplied formatter.- Parameters:
formatter- the formatter used for parsing- Throws:
NullPointerException- if formatter is null
-
ParseLocalDateTime
Constructs a new ParseLocalDateTime processor, which parses a String as a LocalDateTime 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
-
parse
Parses the String into the appropriateTemporalAccessortype.- Specified by:
parsein classAbstractTemporalAccessorParsingProcessor<LocalDateTime>- Parameters:
string- the string to parse- Returns:
- the
TemporalAccessortype
-
parse
Parses the String into the appropriateTemporalAccessortype, using the supplied formatter.- Specified by:
parsein classAbstractTemporalAccessorParsingProcessor<LocalDateTime>- Parameters:
string- the string to parseformatter- the formatter to use- Returns:
- the
TemporalAccessortype
-