Annotation Interface Headers
The
Headers
annotation allows java beans to configure how to handle field names in a given input/output
With this annotation, you can configure the sequence of headers to use when reading/writing:
- when reading, the given
sequence()
of header names will be used to refer to each column, irrespective of whether or not the input contains a header row. If empty, and no headers have been defined inCommonSettings.getHeaders()
, the parser will automatically use the first row in the input as the header row, unless the fields in the bean have been annotated usingParsed.index()
only. - when writing, the given
sequence()
of names will be used to refer to each column and will be used for writing the header row ifwrite()
is enabled. If empty, and no headers have been defined inCommonSettings.getHeaders()
, the names given by attributes annotated withParsed.field()
will be used.
This annotation has no effect if CommonSettings.isAutoConfigurationEnabled()
evaluates to false
.
- See Also:
-
Optional Element Summary
Optional ElementsModifier and TypeOptional ElementDescriptionboolean
Indicates whether the first row of on the input should be extracted as a header row.String[]
Returns the sequence of header names in the input/outputboolean
Indicates whether a row with headers should be written to the output.
-
Element Details
-
sequence
String[] sequenceReturns the sequence of header names in the input/output- Returns:
- the sequence of header names in the input/output
- Default:
- {}
-
write
boolean writeIndicates whether a row with headers should be written to the output.- Returns:
- a flag indicating whether to write the headers to the output when writing instances of a java bean.
- Default:
- true
-
extract
boolean extractIndicates whether the first row of on the input should be extracted as a header row.- Returns:
- a flag indicating whether to extract the headers from the first valid row when reading. If
- Default:
- false
-