Class ReferenceTable

All Implemented Interfaces:
RootTable, TableDataSource

public final class ReferenceTable extends FilterTable implements RootTable
This is an implementation of a Table that references a DataTable as its parent. This is a one-to-one relationship unlike the VirtualTable class which is a one-to-many relationship.

The entire purpose of this class is as a filter. We can use it to rename a DataTable class to any domain we feel like. This allows us to generate unique column names.

For example, say we need to join the same table. We can use this method to ensure that the newly joined table won't have duplicate column names.

This object implements RootTable.

Author:
Tobias Downer
  • Method Details

    • getTableName

      public TableName getTableName()
      Filters the name of the table. This returns the declared name of the table.
    • getDataTableDef

      public DataTableDef getDataTableDef()
      Returns the 'modified' DataTableDef object for this reference.
      Specified by:
      getDataTableDef in interface TableDataSource
      Overrides:
      getDataTableDef in class FilterTable
    • findFieldName

      public int findFieldName(Variable v)
      Given a fully qualified variable field name, ie. 'APP.CUSTOMER.CUSTOMERID' this will return the column number the field is at. Returns -1 if the field does not exist in the table.
      Overrides:
      findFieldName in class FilterTable
    • getResolvedVariable

      public Variable getResolvedVariable(int column)
      Returns a fully qualified Variable object that represents the name of the column at the given index. For example, new Variable(new TableName("APP", "CUSTOMER"), "ID")
      Overrides:
      getResolvedVariable in class FilterTable
    • typeEquals

      public boolean typeEquals(RootTable table)
      Description copied from interface: RootTable
      This is function is used to check that two root tables are identical. This is used if we need to chect that the form of the table is the same. Such as in a union operation, when we can only union two tables with the identical columns.
      Specified by:
      typeEquals in interface RootTable