Annotation Type CsvDate
Conversion to the following old-style types is supported:
Date
Calendar
(aGregorianCalendar
is returned)GregorianCalendar
XMLGregorianCalendar
Date
Time
Timestamp
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
.LocalDate
ChronoLocalDateTime
. If this interface is used, the actual type returned isLocalDateTime
.LocalDateTime
ChronoZonedDateTime
. If this interface is used, the actual type returned isZonedDateTime
.ZonedDateTime
Temporal
. If this interface is used, the actual type returned is not defined.Era
. If this interface is used, the actual type returned isIsoEra
.IsoEra
DayOfWeek
HijrahDate
HijrahEra
Instant
JapaneseDate
JapaneseEra
LocalTime
MinguoDate
MinguoEra
Month
MonthDay
OffsetDateTime
OffsetTime
ThaiBuddhistDate
ThaiBuddhistEra
Year
YearMonth
ZoneOffset
This annotation must be used with either CsvBindByName
or CsvBindByPosition
, otherwise it is ignored.
- Since:
- 3.8
-
Optional Element Summary
Optional ElementsModifier and TypeOptional ElementDescriptionTheChronology
that should be used for parsing.String[]
A profile can be used to annotate the same field differently for different inputs or outputs.A date/time format string.TheChronology
that should be used for formatting.boolean
Whether or not the same chronology string is used for writing as for reading.A date/time format string.boolean
Whether or not the same format string is used for writing as for reading.
-
Element Details
-
value
String valueA 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 writeFormatEqualsReadFormatWhether 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
String writeFormatA date/time format string.- Returns:
- The format string for formatting output
- Since:
- 5.0
- See Also:
- Default:
"yyyyMMdd\'T\'HHmmss"
-
chronology
String chronologyTheChronology
that 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
Chronology
in use - Since:
- 5.0
- Default:
"ISO"
-
writeChronologyEqualsReadChronology
boolean writeChronologyEqualsReadChronologyWhether 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
String writeChronologyTheChronology
that should be used for formatting.- Returns:
- The
Chronology
in use - Since:
- 5.0
- See Also:
- Default:
"ISO"
-
profiles
String[] profilesA profile can be used to annotate the same field differently for different inputs or outputs.Perhaps you have multiple input sources, and they all use different header names or positions for the same data. With profiles, you don't have to create different beans with the same fields and different annotations for each input. Simply annotate the same field multiple times and specify the profile when you parse the input.
The same applies to output: if you want to be able to represent the same data in multiple CSV formats (that is, with different headers or orders), annotate the bean fields multiple times with different profiles and specify which profile you want to use on writing.
Results are undefined if profile names are not unique.
If the same configuration applies to multiple profiles, simply list all applicable profile names here. This parameter is an array of strings.
The empty string, which is the default value, specifies the default profile and will be used if no annotation for the specific profile being used can be found, or if no profile is specified.
- Returns:
- The names of the profiles this configuration is for
- Since:
- 5.4
- Default:
{""}
-