net.sf.flatpack
Interface Parser

All Known Implementing Classes:
AbstractDelimiterParser, AbstractFixedLengthParser, AbstractParser, BuffReaderDelimParser, BuffReaderFixedParser, DBDelimiterParser, DBFixedLengthParser, DelimiterParser, FixedLengthParser

public interface Parser

PZParser is ready to parse the data and return an object that can then be traversed. The default parser should NOT handle short lines, the user can change it prior to calling parse.

Author:
Benoit Xhenseval, Paul Zepernick

Method Summary
 java.lang.String getDataFileTable()
          Returns the table name that will be used to read the MetaData from the db.
 java.lang.String getDataStructureTable()
          Returns the table name that will be used to read the MetaData from the db.
 boolean isColumnNamesCaseSensitive()
          Default is false
 boolean isFlagEmptyRows()
           
 boolean isHandlingShortLines()
           
 boolean isIgnoreExtraColumns()
           
 boolean isIgnoreParseWarnings()
          Default is false
 boolean isNullEmptyStrings()
           
 boolean isStoreRawDataToDataError()
           
 boolean isStoreRawDataToDataSet()
           
 DataSet parse()
          Start the parsing.
 void setColumnNamesCaseSensitive(boolean columnNamesCaseSensitive)
          Default is false
 void setDataFileTable(java.lang.String dataFileTable)
          Sets the table name that will be used to read the MetaData from the db.
 void setDataStructureTable(java.lang.String dataStructureTable)
          Sets the table name that will be used to read the MetaData from the db.
 void setFlagEmptyRows(boolean flagEmptyRows)
          when true, will analyze the row to see if all elements are empty and place a flag on the DataSet indicating if the row is empty.
 void setHandlingShortLines(boolean handleShortLines)
           
 void setIgnoreExtraColumns(boolean ignoreExtraColumns)
           
 void setIgnoreParseWarnings(boolean ignoreParseWarnings)
           
 void setNullEmptyStrings(boolean nullEmptyStrings)
           
 void setStoreRawDataToDataError(boolean storeRawDataToDataError)
          when true, the parser will place the data of the line which failed the parse and place it into the DataError object.
 void setStoreRawDataToDataSet(boolean storeRawDataToDataError)
          WARNING!!
 

Method Detail

parse

DataSet parse()
Start the parsing. Will return "null" if the parse fails and the DataSet cannot be created

Returns:
the data set resulting from parsing

isHandlingShortLines

boolean isHandlingShortLines()
Returns:
true, lines with less columns then the amount of column headers will be added as empty's instead of producing an error

setHandlingShortLines

void setHandlingShortLines(boolean handleShortLines)
Parameters:
handleShortLines - - when flagged as true, lines with less columns then the amount of column headers will be added as empty's instead of producing an error

isIgnoreExtraColumns

boolean isIgnoreExtraColumns()
Returns:
true, detail lines with a length or column count > the mapping definition will be truncated and the reader will NOT register these lines as errors in the DataError collection.

setIgnoreExtraColumns

void setIgnoreExtraColumns(boolean ignoreExtraColumns)
Parameters:
ignoreExtraColumns - when true, detail lines with a length or column count > the mapping definition will be truncated and the reader will NOT register these lines as errors in the DataError collection.

isColumnNamesCaseSensitive

boolean isColumnNamesCaseSensitive()
Default is false

Returns:
true, column names will have to be an exact match when retrieving the value of a column. Example when true: Column name = AColumnName ; getString("acolumnname") would fail Example when false: Column name = AColumnName ; getString("acolumnname") would pass

setColumnNamesCaseSensitive

void setColumnNamesCaseSensitive(boolean columnNamesCaseSensitive)
Default is false

Parameters:
columnNamesCaseSensitive - when true, column names will have to be an exact match when retrieving the value of a column. Example when true: Column name = AColumnName ; getString("acolumnname") would fail Example when false: Column name = AColumnName ; getString("acolumnname") would pass

isIgnoreParseWarnings

boolean isIgnoreParseWarnings()
Default is false

Returns:
true, warnings encountered during parsing will not be included in the DataSet errors

setIgnoreParseWarnings

void setIgnoreParseWarnings(boolean ignoreParseWarnings)
Parameters:
ignoreParseWarnings - when true, warnings encountered during parsing will not be included in the DataSet errors

isNullEmptyStrings

boolean isNullEmptyStrings()
Returns:
true, empty Strings will get returned as NULL when calling DataSet.getString()

setNullEmptyStrings

void setNullEmptyStrings(boolean nullEmptyStrings)
Parameters:
nullEmptyStrings - when true, empty Strings will get returned as NULL when calling DataSet.getString()

isFlagEmptyRows

boolean isFlagEmptyRows()
Returns:
flagEmptyRows when true, will analyze the row to see if all elements are empty and place a flag on the DataSet indicating if the row is empty

setFlagEmptyRows

void setFlagEmptyRows(boolean flagEmptyRows)
when true, will analyze the row to see if all elements are empty and place a flag on the DataSet indicating if the row is empty. This will slow down the parse and should only be used when necessary. It is off by default.

Parameters:
flagEmptyRows -

isStoreRawDataToDataError

boolean isStoreRawDataToDataError()
Returns:
when true, the parser will place the data of the line which failed the parse and place it into the DataError object. DataError.getRawData() can be called to retrieve the line.

setStoreRawDataToDataError

void setStoreRawDataToDataError(boolean storeRawDataToDataError)
when true, the parser will place the data of the line which failed the parse and place it into the DataError object. DataError.getRawData() can be called to retrieve the line.

Parameters:
storeRawDataToDataError -

isStoreRawDataToDataSet

boolean isStoreRawDataToDataSet()
Returns:
when true, the parser will place the data of the line into the DataSet object. DataSet.getRawData() can be called to retrieve the line.

setStoreRawDataToDataSet

void setStoreRawDataToDataSet(boolean storeRawDataToDataError)
WARNING!! Setting this option has potential to cause high memory usage. when true, the parser will place the data of the line into the DataSet object. DataSet.getRawData() can be called to retrieve the line.

Parameters:
storeRawDataToDataError -

getDataFileTable

java.lang.String getDataFileTable()
Returns the table name that will be used to read the MetaData from the db. The default table name is DATAFILE. This may be problimatic for some who are using case sensistive db table names or who wish to provide a different table name in the db. This is only applicable when using a database for file mappings.

Returns:
the DATAFILE table name

setDataFileTable

void setDataFileTable(java.lang.String dataFileTable)
Sets the table name that will be used to read the MetaData from the db. The default table name is DATAFILE. This may be problimatic for some who are using case sensistive db table names or who wish to provide a different table name in the db. This is only applicable when using a database for file mappings.

Parameters:
dataFileTable - Name of the table name to use in place of "DATAFILE"

getDataStructureTable

java.lang.String getDataStructureTable()
Returns the table name that will be used to read the MetaData from the db. The default table name is DATASTRUCTURE. This may be problimatic for some who are using case sensistive db table names or who wish to provide a different table name in the db. This is only applicable when using a database for file mappings.

Returns:
the DATASTRUCTURE table name

setDataStructureTable

void setDataStructureTable(java.lang.String dataStructureTable)
Sets the table name that will be used to read the MetaData from the db. The default table name is DATASTRUCTURE. This may be problimatic for some who are using case sensistive db table names or who wish to provide a different table name in the db. This is only applicable when using a database for file mappings.

Parameters:
dataStructureTable - Name of the table name to us in placfe of "DATASTRUCTURE"


Copyright © 2006-2011 Appendium - Portfolio Financing Platform. All Rights Reserved.