Class TableName

  • All Implemented Interfaces:
    java.lang.Comparable<TableName>

    public final class TableName
    extends java.lang.Object
    implements java.lang.Comparable<TableName>
    A table name.
    • Constructor Summary

      Constructors 
      Constructor Description
      TableName​(DatabaseName databaseName, Name schemaName, Name tableName)
      Constructs a properly escaped fully qualified TableName.
      TableName​(DatabaseName databaseName, Name schemaName, java.lang.String tableName)
      Constructs a properly escaped fully qualified TableName.
      TableName​(DatabaseName databaseName, java.lang.String schemaName, Name tableName)
      Constructs a properly escaped fully qualified TableName.
      TableName​(DatabaseName databaseName, java.lang.String schemaName, java.lang.String tableName)
      Constructs a properly escaped fully qualified TableName.
      TableName​(Name tableName)
      Constructs a properly escaped non-qualified TableName from a Name
      TableName​(Name schemaName, Name tableName)
      Constructs a properly escaped qualified TableName.
      TableName​(Name databaseName, Name schemaName, Name tableName)
      Constructs a properly escaped fully qualified TableName.
      TableName​(Name databaseName, Name schemaName, java.lang.String tableName)
      Constructs a properly escaped fully qualified TableName.
      TableName​(Name schemaName, java.lang.String tableName)
      Constructs a properly escaped partly qualified TableName.
      TableName​(Name databaseName, java.lang.String schemaName, Name tableName)
      Constructs a properly escaped fully qualified TableName.
      TableName​(Name databaseName, java.lang.String schemaName, java.lang.String tableName)
      Constructs a properly escaped fully qualified TableName.
      TableName​(SchemaName schemaName, Name tableName)
      Constructs a properly escaped partly qualified TableName.
      TableName​(SchemaName schemaName, java.lang.String tableName)
      Constructs a properly escaped partly qualified TableName.
      TableName​(java.lang.String tableName)
      Constructs a properly escaped non-qualified TableName.
      TableName​(java.lang.String schemaName, Name tableName)
      Constructs a properly escaped partly qualified TableName.
      TableName​(java.lang.String databaseName, Name schemaName, Name tableName)
      Constructs a properly escaped fully qualified TableName.
      TableName​(java.lang.String databaseName, Name schemaName, java.lang.String tableName)
      Constructs a properly escaped fully qualified TableName.
      TableName​(java.lang.String schemaName, java.lang.String tableName)
      Constructs a properly escaped partly qualified TableName.
      TableName​(java.lang.String databaseName, java.lang.String schemaName, Name tableName)
      Constructs a properly escaped fully qualified TableName.
      TableName​(java.lang.String databaseName, java.lang.String schemaName, java.lang.String tableName)
      Constructs a properly escaped fully qualified TableName.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int compareTo​(TableName other)
      Compares this name with the specified name for order.
      boolean equals​(java.lang.Object that)
      Checks for equality.
      java.util.Optional<DatabaseName> getDatabaseName()
      Gets the optional Database name prefix
      Name getName()
      Gets the Schema name without the optional Schema name prefix
      java.util.Optional<SchemaName> getSchemaName()
      Gets the optional Schema name prefix
      int hashCode()
      Computes a hash code.
      boolean isFullyQualified()
      Returns whether the table name is qualified i.e Whether the table name has a schema name prefix
      java.lang.String toString()
      Gets a correctly escaped string representation of this schema name, which can be used in a SQL query to refer to the schema
      • Methods inherited from class java.lang.Object

        getClass, notify, notifyAll, wait, wait, wait
    • Field Detail

      • nullSafeTableNameComparator

        public static java.util.Comparator<TableName> nullSafeTableNameComparator
        The null-safe table name comparator.
    • Constructor Detail

      • TableName

        public TableName​(Name tableName)
        Constructs a properly escaped non-qualified TableName from a Name
        Parameters:
        tableName - A non-qualified escaped table name
      • TableName

        public TableName​(java.lang.String tableName)
        Constructs a properly escaped non-qualified TableName.

        The name will be equivalent to calling Sql::escapeName().

        Parameters:
        tableName - A non-qualified unescaped table name.
      • TableName

        public TableName​(SchemaName schemaName,
                         Name tableName)
        Constructs a properly escaped partly qualified TableName.
        Parameters:
        schemaName - The schema name
        tableName - The table name.
      • TableName

        public TableName​(SchemaName schemaName,
                         java.lang.String tableName)
        Constructs a properly escaped partly qualified TableName.
        Parameters:
        schemaName - The schema name
        tableName - An unescaped table name.
      • TableName

        public TableName​(Name schemaName,
                         Name tableName)
        Constructs a properly escaped qualified TableName.
        Parameters:
        schemaName - The schema name
        tableName - The table name.
      • TableName

        public TableName​(Name schemaName,
                         java.lang.String tableName)
        Constructs a properly escaped partly qualified TableName.
        Parameters:
        schemaName - The schema name
        tableName - An unescaped table name.
      • TableName

        public TableName​(java.lang.String schemaName,
                         java.lang.String tableName)
        Constructs a properly escaped partly qualified TableName.
        Parameters:
        schemaName - An unescaped schema name
        tableName - An unescaped table name
      • TableName

        public TableName​(java.lang.String schemaName,
                         Name tableName)
        Constructs a properly escaped partly qualified TableName.
        Parameters:
        schemaName - An unescaped schema name
        tableName - The table name
      • TableName

        public TableName​(DatabaseName databaseName,
                         Name schemaName,
                         Name tableName)
        Constructs a properly escaped fully qualified TableName.
        Parameters:
        databaseName - The database name
        schemaName - The schema name
        tableName - The table name.
      • TableName

        public TableName​(DatabaseName databaseName,
                         Name schemaName,
                         java.lang.String tableName)
        Constructs a properly escaped fully qualified TableName.
        Parameters:
        databaseName - The database name
        schemaName - An unescaped schema name
        tableName - The table name.
      • TableName

        public TableName​(DatabaseName databaseName,
                         java.lang.String schemaName,
                         Name tableName)
        Constructs a properly escaped fully qualified TableName.
        Parameters:
        databaseName - The database name
        schemaName - An unescaped schema name
        tableName - The table name.
      • TableName

        public TableName​(DatabaseName databaseName,
                         java.lang.String schemaName,
                         java.lang.String tableName)
        Constructs a properly escaped fully qualified TableName.
        Parameters:
        databaseName - The database name
        schemaName - An unescaped schema name
        tableName - An unescaped table name.
      • TableName

        public TableName​(Name databaseName,
                         Name schemaName,
                         Name tableName)
        Constructs a properly escaped fully qualified TableName.
        Parameters:
        databaseName - The database name
        schemaName - The schema name
        tableName - The table name.
      • TableName

        public TableName​(Name databaseName,
                         Name schemaName,
                         java.lang.String tableName)
        Constructs a properly escaped fully qualified TableName.
        Parameters:
        databaseName - The database name
        schemaName - The schema name
        tableName - The table name.
      • TableName

        public TableName​(Name databaseName,
                         java.lang.String schemaName,
                         Name tableName)
        Constructs a properly escaped fully qualified TableName.
        Parameters:
        databaseName - The database name
        schemaName - The schema name
        tableName - The table name.
      • TableName

        public TableName​(Name databaseName,
                         java.lang.String schemaName,
                         java.lang.String tableName)
        Constructs a properly escaped fully qualified TableName.
        Parameters:
        databaseName - The database name
        schemaName - The schema name
        tableName - The table name.
      • TableName

        public TableName​(java.lang.String databaseName,
                         Name schemaName,
                         Name tableName)
        Constructs a properly escaped fully qualified TableName.
        Parameters:
        databaseName - An unescaped database name
        schemaName - An unescaped schema name
        tableName - The table name.
      • TableName

        public TableName​(java.lang.String databaseName,
                         Name schemaName,
                         java.lang.String tableName)
        Constructs a properly escaped fully qualified TableName.
        Parameters:
        databaseName - An unescaped database name
        schemaName - The schema name
        tableName - An unescaped table name.
      • TableName

        public TableName​(java.lang.String databaseName,
                         java.lang.String schemaName,
                         Name tableName)
        Constructs a properly escaped fully qualified TableName.
        Parameters:
        databaseName - An unescaped database name
        schemaName - An unescaped schema name
        tableName - The table name.
      • TableName

        public TableName​(java.lang.String databaseName,
                         java.lang.String schemaName,
                         java.lang.String tableName)
        Constructs a properly escaped fully qualified TableName.
        Parameters:
        databaseName - An unescaped database name
        schemaName - An unescaped schema name
        tableName - An unescaped table name.
    • Method Detail

      • toString

        public java.lang.String toString()
        Gets a correctly escaped string representation of this schema name, which can be used in a SQL query to refer to the schema
        Overrides:
        toString in class java.lang.Object
        Returns:
        The escaped schema name
      • getName

        public Name getName()
        Gets the Schema name without the optional Schema name prefix
        Returns:
        The schema name
      • getSchemaName

        public java.util.Optional<SchemaName> getSchemaName()
        Gets the optional Schema name prefix
        Returns:
        The optional schema name
      • getDatabaseName

        public java.util.Optional<DatabaseName> getDatabaseName()
        Gets the optional Database name prefix
        Returns:
        The optional database name
      • isFullyQualified

        public boolean isFullyQualified()
        Returns whether the table name is qualified i.e Whether the table name has a schema name prefix
        Returns:
        Whether the Table Name is fully qualified
      • equals

        public boolean equals​(java.lang.Object that)
        Checks for equality.
        Overrides:
        equals in class java.lang.Object
        Parameters:
        that - The other name.
        Returns:
        Whether the two names are equal.
      • compareTo

        public int compareTo​(TableName other)
        Compares this name with the specified name for order.
        Specified by:
        compareTo in interface java.lang.Comparable<TableName>
        Parameters:
        other - The other table name.
        Returns:
        A negative integer, zero, or a positive integer as this name is less than, equal to, or greater than the other name.
      • hashCode

        public int hashCode()
        Computes a hash code.
        Overrides:
        hashCode in class java.lang.Object