| Modifier and Type | Method and Description |
|---|---|
| public String | Returns: A regular expression, the first capture group of which will be used for conversion to the bean fieldIf this is anything but an empty string, it will be used as a regular expression to extract part of the input before conversion to the bean field. |
| public Class | Returns: A class implementingjava.Defines the class used for the collection. |
| public String | Returns: The name of the column in the CSV file from which this field should be taken.If not specified, the name of the column must be identical to the name of the field. |
| public Class | Returns: The converter applied to each of the data points extracted from the inputOnce the input has been split, a custom converter can optionally be specified for conversion of each of the data points. |
| public Class | Returns: The type of the collection elementsDefines what type the elements of the collection should have. |
| public String | Returns: A format string for writing fieldsIf this is anything but an empty string, it will be used as a format
string for |
| public String | Returns: The locale selected. The default is indicated by an empty string.Defines the locale to be used for decoding the argument. |
| public String[] | Returns: The names of the profiles this configuration is forA profile can be used to annotate the same field differently for different inputs or outputs. |
| public boolean | Returns: If the field is required to contain information.Whether or not the annotated field is required to be present in every data set of the input. |
| public String | Returns: The regular expression used for splitting the inputDefines a regular expression for splitting the input. |
| public String | Returns: Delimiter between elements for writing a collectionWhen writing a collection from a bean, this string will be used to separate elements of the collection. |
| public String | |
| public boolean | Returns: Whether the read locale is used for writing as wellWhether or not the same locale is used for writing as for reading. |
| capture | back to summary |
|---|---|
| public String capture() If this is anything but an empty string, it will be used as a regular expression to extract part of the input before conversion to the bean field. An empty string behaves as if the regular expression The regular expression will be compiled and every field of input will be passed through it, naturally after the input has been normalized (quotations and escape characters removed). The first capture group will be extracted, and that string will be passed on to the appropriate conversion routine for the bean field in question. This makes it possible to easily convert input fields with forms like
In the case of splitting the input, which is what this annotation does, the input will be split before this regular expression is then applied to every element of the list resulting from splitting the input. This regular expression is not applied to the entire input field before splitting. The regular expression is applied to the entire string in question
(i.e. with
This is the inverse operation of
| |
| collectionType | back to summary |
|---|---|
| public Class Defines the class used for the collection. This must be a specific implementation of a collection, and not an
interface! The default is set to The logic for determining which class to instantiate for the collection is as follows. In all cases, the implementation must have a nullary constructor.
| |
| column | back to summary |
|---|---|
| public String column() If not specified, the name of the column must be identical to the name of the field.
| |
| converter | back to summary |
|---|---|
| public Class Once the input has been split, a custom converter can optionally be specified for conversion of each of the data points.
| |
| elementType | back to summary |
|---|---|
| public Class Defines what type the elements of the collection should have.
It is necessary to instantiate elements of the collection, and it is not
always possible to determine the type of the given collection at runtime.
A perfect example of this is
| |
| format | back to summary |
|---|---|
| public String format() If this is anything but an empty string, it will be used as a format
string for An empty string behaves as if the format string The format string, if it is not empty, should contain one and only
one This formatting will be applied to every element of the input collection separately before writing. This is the inverse operation of
| |
| locale | back to summary |
|---|---|
| public String locale() Defines the locale to be used for decoding the argument. If not specified, the current default locale is used. The locale must be
one recognized by
The locale must be in a format accepted by
Caution must be exercised with the default locale, for the default locale for numerical types does not mean the locale of the running program, such as en-US or de-DE, but rather no locale. Numbers will be parsed more or less the way the Java compiler would parse them. That means, for instance, that thousands separators in long numbers are not permitted, even if the locale of the running program would accept them. When dealing with locale-sensitive data, it is always best to specify the locale explicitly.
| |
| profiles | back to summary |
|---|---|
| public String[] profiles() A 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.
| |
| required | back to summary |
|---|---|
| public boolean required() Whether or not the annotated field is required to be present in every data set of the input. This means that the input cannot be empty. The output after conversion is not guaranteed to be non-empty. "Input" means the string from the field in the CSV file on reading and the bean member variable on writing.
| |
| splitOn | back to summary |
|---|---|
| public String splitOn() Defines a regular expression for splitting the input. The input string is split using the value of this attribute and the result is put into a collection. The default splits on whitespace.
| |
| writeDelimiter | back to summary |
|---|---|
| public String writeDelimiter() When writing a collection from a bean, this string will be used to separate elements of the collection. Defaults to one space.
| |
| writeLocale | back to summary |
|---|---|
| public String writeLocale() The locale for writing.
This field is ignored unless
| |
| writeLocaleEqualsReadLocale | back to summary |
|---|---|
| public boolean writeLocaleEqualsReadLocale() Whether or not the same locale is used for writing as for reading.
If this is true,
| |