com.ricebridge.csvman
Class LineSpec

java.lang.Object
  extended bycom.ricebridge.csvman.LineSpec

public class LineSpec
extends Object

Stores metadata about each data field.

Converting CSV to data structures such as Java Beans requires additional information about each data field. For example, in the case of Java Beans, the LineSpec identifies the correct get and set methods for each data field (see CsvManager.loadBeans(Object,LineSpec,BeanSpec) for more details).

You can also use a LineSpec in your own LineListeners and LineProviders. Simply create a subclass of LineSpec with your own settings. Be careful when you do this to make sure that you use unique names for your methods and member variables, otherwise they may clash with future versions of LineSpec. The best idea is to prefix or suffix your custom methods with the name of your company or project.

This class differs from CsvSpec in that it is concerned with individual lines and fields of data, and their interpretation. CsvSpec controls the entire CSV loading and saving process.

LineSpec is optional, so all CsvManager load and save methods are available with and without a LineSpec parameter.

In the current version of CSV Manager, you only really need to use a LineSpec when working with Java Beans. None of the other built-in data formats use a LineSpec.

The Source Code of this Java class is available under a BSD-style license.

See Also:
CsvSpec, BeanLineListener, BeanLineProvider

Field Summary
protected  String[] iFieldNames
          The list of field names for each data row.
 
Constructor Summary
LineSpec()
          Create an empty LineSpec.
LineSpec(String[] pFieldNames)
          Create a LineSpec with the specified list of field names.
 
Method Summary
 String[] getFieldNames()
          Get the list of field names.
 String toString()
          A human-friendly description of the current line specification settings.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

iFieldNames

protected String[] iFieldNames
The list of field names for each data row. The meaning of these names depends on the LineListener. For BeanLineListener, these names correspond to the get and set method names. For other LineListeners, the field names may have another interpretation.

Constructor Detail

LineSpec

public LineSpec()
Create an empty LineSpec.


LineSpec

public LineSpec(String[] pFieldNames)
Create a LineSpec with the specified list of field names.

Parameters:
pFieldNames - String[] array of field names
Method Detail

getFieldNames

public String[] getFieldNames()
Get the list of field names.


toString

public String toString()
A human-friendly description of the current line specification settings.



Copyright © 2003-2006 Ricebridge