Package com.opencsv.bean
Annotation Type CsvDate
-
@Documented @Retention(RUNTIME) @Target(FIELD) public @interface CsvDateThis annotation indicates that the destination field is an expression of time.Conversion to the following old-style types is supported:
DateCalendar(aGregorianCalendaris returned)GregorianCalendarXMLGregorianCalendarDateTimeTimestamp
Conversion to the following
TemporalAccessor-style types is supported:TemporalAccessor. If this interface is used, the actual type returned is not defined.ChronoLocalDate. If this interface is used, the actual type returned isLocalDate.LocalDateChronoLocalDateTime. If this interface is used, the actual type returned isLocalDateTime.LocalDateTimeChronoZonedDateTime. If this interface is used, the actual type returned isZonedDateTime.ZonedDateTimeTemporal. If this interface is used, the actual type returned is not defined.Era. If this interface is used, the actual type returned isIsoEra.IsoEraDayOfWeekHijrahDateHijrahEraInstantJapaneseDateJapaneseEraLocalTimeMinguoDateMinguoEraMonthMonthDayOffsetDateTimeOffsetTimeThaiBuddhistDateThaiBuddhistEraYearYearMonthZoneOffset
This annotation must be used with either
CsvBindByNameorCsvBindByPosition, otherwise it is ignored.- Since:
- 3.8
- Author:
- Andrew Rucker Jones
-
-
Optional Element Summary
Optional Elements Modifier and Type Optional Element Description java.lang.StringchronologyTheChronologythat should be used for parsing.java.lang.StringvalueA date/time format string.java.lang.StringwriteChronologyTheChronologythat should be used for formatting.booleanwriteChronologyEqualsReadChronologyWhether or not the same chronology string is used for writing as for reading.java.lang.StringwriteFormatA date/time format string.booleanwriteFormatEqualsReadFormatWhether or not the same format string is used for writing as for reading.
-
-
-
Element Detail
-
value
java.lang.String value
A date/time format string. If this annotation is applied to old-style dates and times, then this must be a string understood bySimpleDateFormat(java.lang.String). If it is applied toTemporalAccessor-based dates and times, then this must be a string understood byDateTimeFormatter. The default value works for both styles and conforms with ISO 8601. Locale information, if specified, is gleaned from one of the other CSV-related annotations and is used for conversion.- Returns:
- The format string for parsing input
- Default:
- "yyyyMMdd\'T\'HHmmss"
-
-
-
writeFormatEqualsReadFormat
boolean writeFormatEqualsReadFormat
Whether or not the same format string is used for writing as for reading. If this is true,value()is used for both reading and writing andwriteFormat()is ignored.- Returns:
- Whether the read format is used for writing as well
- Since:
- 5.0
- Default:
- true
-
-
-
writeFormat
java.lang.String writeFormat
A date/time format string.- Returns:
- The format string for formatting output
- Since:
- 5.0
- See Also:
value(),writeFormatEqualsReadFormat()
- Default:
- "yyyyMMdd\'T\'HHmmss"
-
-
-
chronology
java.lang.String chronology
TheChronologythat should be used for parsing.The value must be understood by
Chronology.of(String). The requisite ID for the desired Chronology can usually be found in the Javadoc for thegetId()method of the specific implementation.This value is only used for
TemporalAccessor-based fields. It is ignored for old-style dates and times.The default value specifies the ISO-8601 chronology. If a blank string or empty string is specified, the chronology is
taken from the locale.- Returns:
- The
Chronologyin use - Since:
- 5.0
- Default:
- "ISO"
-
-
-
writeChronologyEqualsReadChronology
boolean writeChronologyEqualsReadChronology
Whether or not the same chronology string is used for writing as for reading. If this is true,chronology()is used for both reading and writing andwriteChronology()is ignored.- Returns:
- Whether the read chronology is used for writing as well
- Since:
- 5.0
- Default:
- true
-
-
-
writeChronology
java.lang.String writeChronology
TheChronologythat should be used for formatting.- Returns:
- The
Chronologyin use - Since:
- 5.0
- See Also:
chronology(),writeChronologyEqualsReadChronology()
- Default:
- "ISO"
-
-