Class ConverterDate

All Implemented Interfaces:
CsvConverter

public class ConverterDate extends AbstractCsvConverter
This class converts an input to a date type.

This class should work with any type derived from Date 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:

  • java.util.Date
  • java.sql.Date
  • java.sql.Time
  • java.sql.Timestamp

This class should work for any type that implements Calendar or is derived from XMLGregorianCalendar. The following types are explicitly supported:

  • Calendar (always a GregorianCalendar)
  • GregorianCalendar
  • XMLGregorianCalendar
It is also known to work with org.apache.xerces.jaxp.datatype.XMLGregorianCalendarImpl.

This class works for all types from the JDK that implement TemporalAccessor.

Since:
4.2 (previously BeanFieldDate since 3.8)
See Also:
  • Field Details

  • Constructor Details

    • ConverterDate

      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.
      Parameters:
      type - The type of the field being populated
      locale - If not null or empty, specifies the locale used for converting locale-specific data types
      writeLocale - If not null or empty, specifies the locale used for converting locale-specific data types for writing
      errorLocale - The locale to use for error messages
      readFormat - The string to use for parsing the date. See CsvDate.value()
      writeFormat - The string to use for formatting the date. See CsvDate.writeFormat()
      readChronology - The Chronology to be used for reading if TemporalAccessor-based fields are in use
      writeChronology - The Chronology to be used for writing if TemporalAccessor-based fields are in use
  • Method Details