This class should work with any type derived from java.
as long as it has a constructor taking one long that specifies the number
of milliseconds since the epoch. The following types are explicitly
supported:
This class should work for any type that implements
java. or is derived from
javax.. The following types are
explicitly supported:
This class works for all types from the JDK that implement
java..
com.opencsv.bean.CsvDate
| Modifier and Type | Field and Description |
|---|---|
| private static final String | |
| private final DateTimeFormatter | readDtf
The formatter for all inputs to
|
| private final SimpleDateFormat | readSdf
The formatter for all inputs to old-style date representations. |
| private final BiFunction | readTemporalConversionFunction
A reference to the function to use when converting from strings to
|
| private final DateTimeFormatter | writeDtf
The formatter for all outputs from
|
| private final SimpleDateFormat | writeSdf
The formatter for all outputs from old-style date representations. |
| private final BiFunction | writeTemporalConversionFunction
A reference to the function to use when converting from
|
| Access | Constructor and Description |
|---|---|
| public | ConverterDate(Class<?>
The type of the field being populated type, String If not null or empty, specifies the locale used for
converting locale-specific data types locale, String If not null or empty, specifies the locale used for
converting locale-specific data types for writing writeLocale, Locale The locale to use for error messages errorLocale, String The string to use for parsing the date. See
readFormat, String com.The string to use for formatting the date. See
writeFormat, String CsvDate#writeFormat()The readChronology, String java. to be used
for reading if
java.-based
fields are in useThe writeChronology)java. to be
used for writing if
java.-based
fields are in useInitializes the class. |
| Modifier and Type | Method and Description |
|---|---|
| public Object | convertToRead(String value)
Implements com. Method for converting from a string to the proper data type of the destination field. |
| public String | Returns: A string representation of the date. If alocale or conversion
pattern has been specified through annotations, these are used when
creating the return value.The object containing a date of one of the supported types value)Overrides com. Implements com. This method converts the encapsulated date type to a string, respecting any locales and conversion patterns that have been set through opencsv annotations. |
| private BiFunction | |
| private BiFunction | |
| private Chronology | |
| private SimpleDateFormat | |
| private DateTimeFormatter |
| CSVDATE_NOT_DATE | back to summary |
|---|---|
| private static final String CSVDATE_NOT_DATE | |
| readDtf | back to summary |
|---|---|
| private final DateTimeFormatter readDtf The formatter for all inputs to
| |
| readSdf | back to summary |
|---|---|
| private final SimpleDateFormat readSdf The formatter for all inputs to old-style date representations. It is absolutely critical that access to this member variable is always synchronized! | |
| readTemporalConversionFunction | back to summary |
|---|---|
| private final BiFunction<DateTimeFormatter, String, TemporalAccessor> readTemporalConversionFunction A reference to the function to use when converting from strings to
| |
| writeDtf | back to summary |
|---|---|
| private final DateTimeFormatter writeDtf The formatter for all outputs from
| |
| writeSdf | back to summary |
|---|---|
| private final SimpleDateFormat writeSdf The formatter for all outputs from old-style date representations. It is absolutely critical that access to this member variable is always synchronized! | |
| writeTemporalConversionFunction | back to summary |
|---|---|
| private final BiFunction<DateTimeFormatter, TemporalAccessor, String> writeTemporalConversionFunction A reference to the function to use when converting from
| |
| ConverterDate | back to summary |
|---|---|
| public ConverterDate(Class<?> type, String locale, String writeLocale, Locale errorLocale, String readFormat, String writeFormat, String readChronology, String writeChronology) Initializes the class. This includes initializing the locales for reading and writing, the format strings for reading and writing, and the chronologies for reading and writing, all as necessary based on the type to be converted.
| |
| convertToRead | back to summary |
|---|---|
| public Object convertToRead(String value) throws CsvDataTypeMismatchException Implements com. Doc from com. Method for converting from a string to the proper data type of the destination field.
| |
| convertToWrite | back to summary |
|---|---|
| public String convertToWrite(Object value) throws CsvDataTypeMismatchException Overrides com. Implements com. This method converts the encapsulated date type to a string, respecting any locales and conversion patterns that have been set through opencsv annotations.
| |
| determineReadTemporalConversionFunction | back to summary |
|---|---|
| private BiFunction | |
| determineWriteTemporalConversionFunction | back to summary |
|---|---|
| private BiFunction | |
| getChronology | back to summary |
|---|---|
| private Chronology getChronology(String readChronology, Locale locale2) | |
| setDateFormat | back to summary |
|---|---|
| private SimpleDateFormat setDateFormat(String format, Locale formatLocale) | |
| setDateTimeFormatter | back to summary |
|---|---|
| private DateTimeFormatter setDateTimeFormatter(String format, Locale formatLocale) | |