Class AbstractDataReader

java.lang.Object
net.simplace.core.io.AbstractDataReader
Direct Known Subclasses:
AbstractAsciiReader, AbstractListReader

public abstract class AbstractDataReader extends Object
Base class of readers that read tabular data according to an XML configuration: each child element of the configuration defines a column (ColumnData); attribute values may contain parameters of the observable.
  • Field Details

    • iConfigData

      protected org.jdom2.Element iConfigData
      the configuration element with one child per column
    • iObservable

      protected FWObservable iObservable
      provides the parameters for the configuration values
    • iColumnsData

      protected Vector<ColumnData> iColumnsData
      the column definitions
  • Constructor Details

    • AbstractDataReader

      public AbstractDataReader(org.jdom2.Element aConfigData, FWObservable aObservable)
      Parameters:
      aConfigData - the configuration element with one child per column
      aObservable - provides the parameters for the configuration values
  • Method Details

    • readData

      public void readData() throws Exception
      Creates the column definitions from the configuration (invalid ones are skipped) and reads column heads and title. Subclasses read the data afterwards.
      Throws:
      Exception - if reading fails
    • initColumnHeads

      protected abstract void initColumnHeads() throws Exception
      Initializes the column names that are not configured (e.g. from a header line).
      Throws:
      Exception - if reading fails
    • initTitle

      protected abstract void initTitle() throws Exception
      Initializes the title of the data (e.g. from a title line).
      Throws:
      Exception - if reading fails
    • getIntegerValue

      public static Integer getIntegerValue(FWObservable aObservable, org.jdom2.Element aElement, String aAttributeName, Integer aDefaultValue)
      Reads an integer attribute; parameters in the value are replaced first.
      Parameters:
      aObservable - provides the parameters
      aElement - the element, may be null
      aAttributeName - name of the attribute
      aDefaultValue - value returned if the attribute is missing or not an integer (a warning is logged)
      Returns:
      the attribute value, or the default