Class TableReference

java.lang.Object
org.apache.sis.internal.sql.feature.TableReference
Direct Known Subclasses:
Relation

public class TableReference extends Object
A (catalog, schema, table) name tuple, which can be used as keys in hash map.
Since:
1.0
Version:
1.2
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    final String
    The catalog, schema and table name of a table.
    (package private) final String
    Ignored by this class; reserved for caller and subclasses usage.
    final String
    The catalog, schema and table name of a table.
    final String
    The catalog, schema and table name of a table.
  • Constructor Summary

    Constructors
    Constructor
    Description
    TableReference(String catalog, String schema, String table, String freeText)
    Creates a new tuple with the given names.
    TableReference(org.opengis.util.GenericName name, String comments)
    Creates a new tuple with the components of the given name.
  • Method Summary

    Modifier and Type
    Method
    Description
    final boolean
    Returns true if the given object is a TableReference with equal table, schema and catalog names.
    (package private) final org.opengis.util.GenericName
    getName(Analyzer analyzer)
    Creates a name for the feature type backed by this table.
    final int
    Computes a hash code from the catalog, schema and table names.
    (package private) static TreeTable.Node
    Adds a child of the given name to the given parent node.
    (package private) static String[]
    splitName(org.opengis.util.GenericName name)
    Splits the given name in (catalog, schema, table) tuple.
    Formats a string representation of this object for debugging purpose.
    (package private) static String
    Formats a graphical representation of an object for debugging purpose.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • catalog

      public final String catalog
      The catalog, schema and table name of a table. The table name is mandatory, but the schema and catalog names may be null or empty. Note that an empty string and null values have different meanings in JDBC metadata:
      • An empty string means that the table name has no catalog (or schema).
      • A null value means that the catalog (or schema) name should be ignored.
      Names are stored here as they were given by JDBC because those names are sometimes compared with other JDBC metadata or used for fetching more table metadata.
    • schema

      public final String schema
      The catalog, schema and table name of a table. The table name is mandatory, but the schema and catalog names may be null or empty. Note that an empty string and null values have different meanings in JDBC metadata:
      • An empty string means that the table name has no catalog (or schema).
      • A null value means that the catalog (or schema) name should be ignored.
      Names are stored here as they were given by JDBC because those names are sometimes compared with other JDBC metadata or used for fetching more table metadata.
    • table

      public final String table
      The catalog, schema and table name of a table. The table name is mandatory, but the schema and catalog names may be null or empty. Note that an empty string and null values have different meanings in JDBC metadata:
      • An empty string means that the table name has no catalog (or schema).
      • A null value means that the catalog (or schema) name should be ignored.
      Names are stored here as they were given by JDBC because those names are sometimes compared with other JDBC metadata or used for fetching more table metadata.
    • freeText

      final String freeText
      Ignored by this class; reserved for caller and subclasses usage. May be null. If non-null, then it is guaranteed non-empty and without leading or trailing spaces.
  • Constructor Details

    • TableReference

      TableReference(String catalog, String schema, String table, String freeText)
      Creates a new tuple with the given names.
    • TableReference

      TableReference(org.opengis.util.GenericName name, String comments)
      Creates a new tuple with the components of the given name.
  • Method Details

    • splitName

      static String[] splitName(org.opengis.util.GenericName name)
      Splits the given name in (catalog, schema, table) tuple. Those components are returned in an array of length 3, in reverse order.
    • getName

      final org.opengis.util.GenericName getName(Analyzer analyzer)
      Creates a name for the feature type backed by this table. This method does not cache the value; caller is expected to invoke only once and store the name.
      Parameters:
      analyzer - the object which is analyzing the database schema for inferring feature types.
    • equals

      public final boolean equals(Object obj)
      Returns true if the given object is a TableReference with equal table, schema and catalog names. All other properties that may be defined in subclasses (column names, action on delete, etc.) are ignored; this method is not for testing if two Relation are fully equal. The purpose of this method is only to use TableReference as keys in a HashSet for remembering full coordinates of tables that may need to be analyzed later.
      Overrides:
      equals in class Object
      Returns:
      whether the given object is another TableReference for the same table.
    • hashCode

      public final int hashCode()
      Computes a hash code from the catalog, schema and table names. See equals(Object) for information about the purpose.
      Overrides:
      hashCode in class Object
      Returns:
      a hash code value for this table reference.
    • newChild

      @Debug static TreeTable.Node newChild(TreeTable.Node parent, String name)
      Adds a child of the given name to the given parent node. This is a convenience method for toString() implementations.
      Parameters:
      parent - the node where to add a child.
      name - the name to assign to the child.
      Returns:
      the child added to the parent.
    • toString

      static String toString(Object owner, Consumer<TreeTable.Node> appender)
      Formats a graphical representation of an object for debugging purpose. This representation can be printed to the standard output stream (for example) if the output device uses a monospaced font and supports Unicode.
    • toString

      public String toString()
      Formats a string representation of this object for debugging purpose.
      Overrides:
      toString in class Object
      Returns:
      a string representation of this table reference.