/*
 * Copyright 2016 Andrew Rucker Jones.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.opencsv.bean;

import java.lang.annotation.*;

Allows us to specify a class that will perform the translation from source to destination. For special needs, we can implement a class that takes the source field from the CSV and translates it into a form of our choice.
Author:Andrew Rucker Jones
Since:3.8
/** * Allows us to specify a class that will perform the translation from source * to destination. * For special needs, we can implement a class that takes the source field from * the CSV and translates it into a form of our choice. * * @author Andrew Rucker Jones * @since 3.8 */
@Documented @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.FIELD) public @interface CsvCustomBindByPosition {
The class that takes care of the conversion. Every custom converter must be descended from AbstractBeanField and override the method AbstractBeanField.convert(String).
Returns:The implementation that can convert to the type of this field.
/** * The class that takes care of the conversion. * Every custom converter must be descended from * {@link com.opencsv.bean.AbstractBeanField} and override the method * {@link com.opencsv.bean.AbstractBeanField#convert(java.lang.String)}. * * @return The implementation that can convert to the type of this field. */
Class<? extends AbstractBeanField> converter();
The column position in the input that is used to fill the annotated field.
Returns:The position of the column in the CSV file from which this field should be taken. This column number is zero-based.
/** * The column position in the input that is used to fill the annotated * field. * * @return The position of the column in the CSV file from which this field * should be taken. This column number is zero-based. */
int position();
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.
Returns:If the field is required to contain information.
Since:3.10
/** * 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. * * @return If the field is required to contain information. * @since 3.10 */
boolean required() default false; }