Class DBFColumnSpec

java.lang.Object
ca.spatial.table.DBFColumnSpec

public class DBFColumnSpec extends Object
This object encapsulates the information about a column to be written to a dBase file. An ArrayList of these objects can be manufactured using the DBFWriterSetup class. Once created, they are typically passed to a DBFWriter object, or to the AttributeStore.exportDBF(Window,String,ArrayList,int[]) or AttributeStore.exportCSV(String,ArrayList,int[],Observer) methods.

The object requires the following data items:

Required items
ItemDescription
sourceAn expression or column name that defines the data contents for this column. This will be evaluated in the context of a source data table associated with the export method.
aliasA name to be given to this column. For dBase files the maximum length of the column name is 10 characters. There is no specified maximum column heading size for CSV files (although Excel has a maximum cell size of 32767 characters).
typeThe data type used for the field. The following types are supported:
  • C character
  • N numeric (integer if dec = 0, otherwise floating point)
  • L boolean
widthThe width of the field. For dBase this will strictly limit the number of data characters that can be written to the field. Character values that exceed the length will be right-truncated. Numberic values that cannot fit with the given space (e.g. 9999 in a field width of 3) will store incorrect values. This value is ignored for CSV files.
decThe number of places of precision following the decimal place.
  • Constructor Details

    • DBFColumnSpec

      public DBFColumnSpec(String source, String alias, String type, int width, int dec)
      Instantiate a column specification
      Parameters:
      source - an expression that when evaluated will create the data for this column
      alias - the field name
      type - the data type
      width - the width of the field
      dec - the number of places of precision following the decimal place
  • Method Details

    • getSource

      public String getSource()
      Get the source expression
    • setSource

      public DBFColumnSpec setSource(String source)
      Set the source expression
    • getAlias

      public String getAlias()
      Get the column heading
    • setAlias

      public DBFColumnSpec setAlias(String alias)
      Set the alias value
    • getType

      public String getType()
      Get the data type
    • setType

      public DBFColumnSpec setType(String type)
      Set the type value
    • getWidth

      public int getWidth()
      Get the field width
    • setWidth

      public DBFColumnSpec setWidth(int width)
      Set the width value
    • getDec

      public int getDec()
      Get the number of places of precision following the decimal place
    • setDec

      public DBFColumnSpec setDec(int dec)
      Set the dec value
    • getFormat

      public int getFormat()
      Get the data type code as defined in the AttributeFormat class.