Any implementing class must be thread-safe. Specifically, the following methods must be thread-safe:
| Modifier and Type | Method and Description |
|---|---|
| public void | captureHeader(CSVReader
The CSVReader to use for header parsing reader)Implementation of this method can grab the header line before parsing begins to use to map columns to bean properties. |
| public String[] | Returns: An array of column names for a header. This may be an empty array if no header should be written, but it must not benull.One fully populated bean from which the header can be derived.
This is important in the face of joining and splitting. If we have a
MultiValuedMap as a field that is the target for a join on reading, that
same field must be split into multiple columns on writing. Since the
joining is done via regular expressions, it is impossible for opencsv
to know what the column names are supposed to be on writing unless this
bean includes a fully populated map. bean)Implementations of this method must return an array of column headers based on the contents of the mapping strategy. |
| public default void | ignoreFields(MultiValuedMap<Class<?>, Field>
All fields to be ignored, mapped from the classes of which
they are members. These are the classes as opencsv
encounters them, not necessarily the declaring classes if
any fields are inherited. May be fields)null.When processing a bean for reading or writing, ignore the given fields from the given classes completely, including all annotations and requirements. |
| public default boolean | Returns: Whether the mapping strategy is driven by annotations
Deprecated
This is simply no longer necessary.
Determines whether the mapping strategy is driven by annotations. |
| public T | Returns: A bean containing the converted information from the inputA line of input returned from line)com.Takes a line of input from a CSV file and creates a bean out of it. |
| public default void | setErrorLocale(Locale
Locale for error messages. If null, the default locale
is used. errorLocale)Sets the locale for all error messages. |
| public default void | setProfile(String
The profile to use profile)Sets the profile this mapping strategy will use when configuring bean fields. |
| public void | |
| public String[] | Returns: The converted values of the bean fields in the correct order, ready to be passed to acom.The bean to be transmuted bean)Transmutes a bean instance into an array of |
| captureHeader | back to summary |
|---|---|
| public void captureHeader(CSVReader reader) throws IOException, CsvRequiredFieldEmptyException Implementation of this method can grab the header line before parsing begins to use to map columns to bean properties.
| |
| generateHeader | back to summary |
|---|---|
| public String[] generateHeader(T bean) throws CsvRequiredFieldEmptyException Implementations of this method must return an array of column headers
based on the contents of the mapping strategy.
If no header can or should be generated, an array of zero length must
be returned, and not
| |
| ignoreFields | back to summary |
|---|---|
| public default void ignoreFields(MultiValuedMap<Class<?>, Field> fields) throws IllegalArgumentException When processing a bean for reading or writing, ignore the given fields from the given classes completely, including all annotations and requirements. This method has two compelling applications:
Calling this method overwrites the fields passed in from any previous
calls. It is legal to call this method before calling
Caution must be exercised with this method when letting opencsv
automatically determine the mapping strategy. When a field is ignored,
opencsv pretends it does not exist at all. If, for instance, all fields
annotated with opencsv binding annotations are ignored, opencsv will
automatically switch to An implementation of this interface is not required to implement this
method. The default implementation throws
| |
| isAnnotationDriven | back to summary |
|---|---|
| public default boolean isAnnotationDriven()
Deprecated This is simply no longer necessary. Determines whether the mapping strategy is driven by annotations.
| |
| populateNewBean | back to summary |
|---|---|
| public T populateNewBean(String[] line) throws CsvBeanIntrospectionException, CsvFieldAssignmentException, CsvChainedException Takes a line of input from a CSV file and creates a bean out of it.
| |
| setErrorLocale | back to summary |
|---|---|
| public default void setErrorLocale(Locale errorLocale) Sets the locale for all error messages. The default implementation does nothing, as it is expected that most implementations of this interface will not support multiple languages.
| |
| setProfile | back to summary |
|---|---|
| public default void setProfile(String profile) Sets the profile this mapping strategy will use when configuring bean fields. The default implementation throws
| |
| setType | back to summary |
|---|---|
| public void setType(Class<? extends T> type) throws CsvBadConverterException Sets the class type that is being mapped.
May perform additional initialization tasks. If instantiating a
mapping strategy, this method should be called after any other
initialization, for example a call to
| |
| transmuteBean | back to summary |
|---|---|
| public String[] transmuteBean(T bean) throws CsvFieldAssignmentException, CsvChainedException Transmutes a bean instance into an array of
| |