Class ColumnData

java.lang.Object
net.simplace.core.io.ColumnData

public class ColumnData extends Object
Definition of one column of a data reader: the character range in a fixed-width line (1-based startCol..endCol) or a constant value, name and data type. A head element defines the row head column.
Author:
Andreas Enders
  • Constructor Details

    • ColumnData

      protected ColumnData(org.jdom2.Element aDataElement, int aColumnIndex, FWObservable aObservable)
      Creates the column from its configuration element (attributes startCol, endCol, value, colName, dataType).
      Parameters:
      aDataElement - the configuration element (head for the row head column)
      aColumnIndex - index of the column (1-based)
      aObservable - provides the parameters for the attribute values
    • ColumnData

      public ColumnData(int aStartCol, int aEndCol, String aColName, String aValue, String aDataType, boolean aIsHeadColumn, int aColumnIndex)
      Parameters:
      aStartCol - first character (1-based)
      aEndCol - last character (1-based, inclusive)
      aColName - column name
      aValue - constant value, or null to read from the line
      aDataType - data type (SQL type name)
      aIsHeadColumn - if this is the row head column
      aColumnIndex - index of the column (1-based)
  • Method Details

    • getColName

      public String getColName()
      Returns:
      the column name
    • getDataType

      public String getDataType()
      Returns:
      the data type; VARCHAR(255) for character data
    • getEndCol

      public Integer getEndCol()
      Returns:
      the last character (1-based, inclusive), or null without range
    • getStartCol

      public Integer getStartCol()
      Returns:
      the first character (1-based), or null without range
    • getColumnIndex

      public int getColumnIndex()
      Returns:
      the index of the column (1-based)
    • initColName

      public void initColName(String aLine, int aI)
      Sets the column name from the header line, unless a name is configured; empty names become ROW_HEAD or Categorie n.
      Parameters:
      aLine - the header line
      aI - not used
    • setColumnIndex

      protected void setColumnIndex(int aColumnIndex)
      Parameters:
      aColumnIndex - the index of the column (1-based)
    • isHeadColumn

      public boolean isHeadColumn()
      Returns:
      true if this is the row head column
    • isCharType

      public boolean isCharType()
      Returns:
      true for character data (no type, CHAR... or VARCHAR...)
    • setColName

      protected void setColName(String aColName)
      Parameters:
      aColName - the column name
    • getValue

      public String getValue(String aLine, int aRowIndex)
      Returns the value of the column for a line: the characters of the column range, or the constant value (with ${ROWCOUNT} replaced by the row index).
      Parameters:
      aLine - the line
      aRowIndex - the row index
      Returns:
      the value
    • setValue

      public void setValue(String aValue)
      Parameters:
      aValue - the constant value, or null to read from the line
    • equals

      public boolean equals(Object aObj)
      Columns are equal if their names are equal.
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
      Returns:
      the hash code of the column name (0 without name)
    • toString

      public String toString()
      Overrides:
      toString in class Object
      Returns:
      ColumnData: name