org.eobjects.metamodel.csv
Class CsvConfiguration

java.lang.Object
  extended by org.eobjects.metamodel.util.BaseObject
      extended by org.eobjects.metamodel.csv.CsvConfiguration
All Implemented Interfaces:
Serializable

public final class CsvConfiguration
extends BaseObject
implements Serializable

Represents the configuration for reading/parsing CSV files.

Author:
Kasper Sørensen
See Also:
Serialized Form

Field Summary
static int DEFAULT_COLUMN_NAME_LINE
           
static char DEFAULT_ESCAPE_CHAR
           
static char DEFAULT_QUOTE_CHAR
           
static char DEFAULT_SEPARATOR_CHAR
           
static int NO_COLUMN_NAME_LINE
           
static char NOT_A_CHAR
          The value is '\\uFFFF', the "not a character" value which should not occur in any valid Unicode string.
 
Constructor Summary
CsvConfiguration()
           
CsvConfiguration(int columnNameLineNumber)
           
CsvConfiguration(int columnNameLineNumber, String encoding, char separatorChar, char quoteChar, char escapeChar)
           
CsvConfiguration(int columnNameLineNumber, String encoding, char separatorChar, char quoteChar, char escapeChar, boolean failOnInconsistentRowLength)
           
 
Method Summary
protected  void decorateIdentity(List<Object> identifiers)
           
 int getColumnNameLineNumber()
          The line number (1 based) from which to get the names of the columns.
 String getEncoding()
          Gets the file encoding to use for reading the file.
 char getEscapeChar()
          Gets the escape char, used for escaping eg.
 char getQuoteChar()
          Gets the quote char, used for encapsulating values.
 char getSeparatorChar()
          Gets the separator char (typically comma or semicolon) for separating values.
 boolean isFailOnInconsistentRowLength()
          Determines whether to fail (by throwing an InconsistentRowLengthException) if a line in the CSV file has inconsistent amounts of columns.
 String toString()
           
 
Methods inherited from class org.eobjects.metamodel.util.BaseObject
classEquals, equals, hashCode
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

NOT_A_CHAR

public static final char NOT_A_CHAR
The value is '\\uFFFF', the "not a character" value which should not occur in any valid Unicode string. This special char can be used to disable either quote chars or escape chars.

See Also:
Constant Field Values

NO_COLUMN_NAME_LINE

public static final int NO_COLUMN_NAME_LINE
See Also:
Constant Field Values

DEFAULT_COLUMN_NAME_LINE

public static final int DEFAULT_COLUMN_NAME_LINE
See Also:
Constant Field Values

DEFAULT_SEPARATOR_CHAR

public static final char DEFAULT_SEPARATOR_CHAR
See Also:
Constant Field Values

DEFAULT_QUOTE_CHAR

public static final char DEFAULT_QUOTE_CHAR
See Also:
Constant Field Values

DEFAULT_ESCAPE_CHAR

public static final char DEFAULT_ESCAPE_CHAR
See Also:
Constant Field Values
Constructor Detail

CsvConfiguration

public CsvConfiguration()

CsvConfiguration

public CsvConfiguration(int columnNameLineNumber)

CsvConfiguration

public CsvConfiguration(int columnNameLineNumber,
                        String encoding,
                        char separatorChar,
                        char quoteChar,
                        char escapeChar)

CsvConfiguration

public CsvConfiguration(int columnNameLineNumber,
                        String encoding,
                        char separatorChar,
                        char quoteChar,
                        char escapeChar,
                        boolean failOnInconsistentRowLength)
Method Detail

isFailOnInconsistentRowLength

public boolean isFailOnInconsistentRowLength()
Determines whether to fail (by throwing an InconsistentRowLengthException) if a line in the CSV file has inconsistent amounts of columns. If set to false (default) MetaModel will gracefully fill in missing null values in or ignore additional values in a line.

Returns:
a boolean indicating whether to fail or gracefully compensate for inconsistent lines in the CSV files.

getColumnNameLineNumber

public int getColumnNameLineNumber()
The line number (1 based) from which to get the names of the columns.

Returns:
the line number (1 based)

getEncoding

public String getEncoding()
Gets the file encoding to use for reading the file.

Returns:
the text encoding of the file.

getSeparatorChar

public char getSeparatorChar()
Gets the separator char (typically comma or semicolon) for separating values.

Returns:
the separator char

getQuoteChar

public char getQuoteChar()
Gets the quote char, used for encapsulating values.

Returns:
the quote char

getEscapeChar

public char getEscapeChar()
Gets the escape char, used for escaping eg. quote chars inside values.

Returns:
the escape char

decorateIdentity

protected void decorateIdentity(List<Object> identifiers)
Specified by:
decorateIdentity in class BaseObject

toString

public String toString()
Overrides:
toString in class BaseObject


Copyright © 2007-2012. All Rights Reserved.