org.nerd4j.csv.conf.mapping.ann.CSVParser 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.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import org.nerd4j.csv.RemarkableASCII;
/**
* Creates a {@link CSVParser} using the annotated
* JavaBean to retrieve the required configurations.
*
* Usage
*
* The {@link CSVParser} annotation is intended
* to be used inside the following annotations:
*
* - {@link CSVReader}.
*
*
*
*
* This annotation is equivalent to the XML configuration csv:parser.
*
*
* @author Nerd4j Team
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.ANNOTATION_TYPE)
public @interface CSVParser
{
/**
* Character used to quote fields.
*
* The character used by default is the double quote ["].
*
* @return character used to quote fields.
*/
public char quote();
/**
* Tells if to treat CSV quotes less strictly.
* More precisely tells the parser not to fail
* in case a not escaped quote is found
* into a field.
*/
public boolean lazyQuotes() default false;
/**
* Character used to escape other characters.
*
* There is no default values for this feature.
*
* @return character used to escape other characters.
*/
public char escape() default RemarkableASCII.NOT_AN_ASCII;
/**
* Character used to separate fields in the CSV source.
*
* The character used by default is the comma [,].
*
* @return character used to separate fields.
*/
public char fieldSep();
/**
* The first of at most two record separator characters.
* This character is mandatory, the second one is optional.
*
* The character used by default is the new line feed [\n].
*
* @return first character used to separate records.
*/
public char recordSep1();
/**
* The second of at most two record separator characters.
* This character is optional, the first one is mandatory.
*
* There is no default values for this feature.
*
* @return second character used to separate records.
*/
public char recordSep2() default RemarkableASCII.NOT_AN_ASCII;
/**
* Set of characters to be completely ignored while parsing.
*
* There is no default values for this feature.
*
* @return set of characters to ignore.
*/
public char[] charsToIgnore() default { RemarkableASCII.NOT_AN_ASCII };
/**
* Set of characters to be ignored if found
* on heading or trailing of a field.
*
* The characters ignored by default are:
*
* - space [ ];
* - horizontal tab [\t];
* - new line feed [\n].
*
*
* @return set of characters to ignore around fields.
*/
public char[] charsToIgnoreAroundFields() default { RemarkableASCII.NOT_AN_ASCII };
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy