org.nerd4j.csv.conf.mapping.ann.CSVColumn Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of nerd4j-csv Show documentation
Show all versions of nerd4j-csv Show documentation
CSV manipulation library.
/*
* #%L
* Nerd4j CSV
* %%
* Copyright (C) 2013 Nerd4j
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Lesser Public License for more details.
*
* You should have received a copy of the GNU General Lesser Public
* License along with this program. If not, see
* .
* #L%
*/
package org.nerd4j.csv.conf.mapping.ann;
import java.lang.annotation.ElementType;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
/**
* Maps a JavaBean property to a CSV column.
*
* Usage
*
* The {@link CSVColumn} annotation can be used with the
* following program elements:
*
* - JavaBean property (getter);
* - JavaBean field.
*
*
*
*
* This annotation is equivalent to the XML configuration csv:column.
*
*
* @author Nerd4j Team
*/
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.FIELD, ElementType.METHOD})
public @interface CSVColumn
{
/**
* The name of the CSV column reported
* in the CSV source header if any, or
* the column index if no header is defined.
*
* @return the column name in the header or the column index.
*/
public String name() default "";
/**
* Tells if the this column is optional or mandatory
* in the output data model.
*
* An optional column means that the related data model
* accepts null
values.
*
*
* The default value for this field is false
.
*
*
* @return true
if the column value is optional.
*/
public boolean optional() default false;
/**
* The name used to refer to a previous configured field processor
* and use it during reading process.
*
* @return name of the referenced processor.
*/
public String readProcessorRef() default "";
/**
* Definition of the processor to use to perform the conversion
* between the CSV column value and the data model field
* during reading process.
*
* @return CSV field processor definition.
*/
public CSVFieldProcessor[] readProcessor() default {};
/**
* The name used to refer to a previous configured field processor
* and use it during writing process.
*
* @return name of the referenced processor.
*/
public String writeProcessorRef() default "";
/**
* Definition of the processor to use to perform the conversion
* between the CSV column value and the data model field
* during writing process.
*
* @return CSV field processor definition.
*/
public CSVFieldProcessor[] writeProcessor() default {};
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy