com.bigdata.util
Class CSVReader.Header

java.lang.Object
  extended by com.bigdata.util.CSVReader.Header
Enclosing class:
CSVReader

public static class CSVReader.Header
extends Object

A header for a column that examines its values and interprets them as floating point numbers, integers, dates, or times when possible and as uninterpreted character data otherwise.

Version:
$Id: CSVReader.java 2265 2009-10-26 12:51:06Z thompsonbry $
Author:
Bryan Thompson

Field Summary
protected static Format[] formats
          An array of formats to be tested against the column values.
 
Constructor Summary
CSVReader.Header(String name)
           
 
Method Summary
 boolean equals(CSVReader.Header o)
          Equal if the headers have the same data.
 String getName()
           
 int hashCode()
          Based on the header name.
 Object parseValue(String text)
          Attempts to interpret the character data as a date/time, currency, percentage, floating point value, or integer.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

formats

protected static final Format[] formats
An array of formats to be tested against the column values. The order in the array is the order in which the formats are tested.

Note that formats DO NOT require a complete match on the source test. For this reason, they are arranged based on the expected ability for the format to be diagnositic. For example, a date such as 4/6/2002 would be interpreted as an integer if you tested the integer format first.

TODO:
consider using regular expressions to select which formats to apply (or which formats to ignore)., verify that the entire text was matched by the format in order to allow the format to be the approved interpretation of the text.
Constructor Detail

CSVReader.Header

public CSVReader.Header(String name)
Method Detail

getName

public String getName()

parseValue

public Object parseValue(String text)
Attempts to interpret the character data as a date/time, currency, percentage, floating point value, or integer. If the text can not be interpreted as any of those formats then it returns the uninterpreted character data.

Parameters:
text - The character data.
Returns:
The parsed value.

equals

public boolean equals(CSVReader.Header o)
Equal if the headers have the same data.


hashCode

public int hashCode()
Based on the header name.

Overrides:
hashCode in class Object

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2006-2009 SYSTAP, LLC. All Rights Reserved.