@Documented @Retention(value=RUNTIME) @Target(value=FIELD) @Repeatable(value=CsvCustomBindByNames.class) public @interface CsvCustomBindByName
Modifier and Type | Required Element and Description |
---|---|
Class<? extends AbstractBeanField> |
converter
The class that takes care of the conversion.
|
Modifier and Type | Optional Element and Description |
---|---|
String |
column
If not specified, the name of the column must be identical to the name
of the field.
|
String[] |
profiles
A profile can be used to annotate the same field differently for
different inputs or outputs.
|
boolean |
required
Whether or not the annotated field is required to be present in every
data set of the input.
|
public abstract Class<? extends AbstractBeanField> converter
AbstractBeanField
and override the method
AbstractBeanField.convert(java.lang.String)
.public abstract String column
public abstract boolean required
public abstract String[] profiles
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.
Copyright © 2005–2023. All rights reserved.