Class SchemaName

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

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

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

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int compareTo​(SchemaName other)
      Compares this name with the other schema name for order.
      boolean equals​(java.lang.Object that)
      Checks two names for equality.
      java.util.Optional<DatabaseName> getDatabaseName()
      Gets the optional Database name prefix
      Name getName()
      Gets the Schema name without the optional Database name prefix
      int hashCode()
      Computes a hash code.
      boolean isFullyQualified()
      Returns whether the schema name is qualified i.e Whether the schema name has a database 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

      • nullSafeSchemaNameComparator

        public static java.util.Comparator<SchemaName> nullSafeSchemaNameComparator
        The null-safe Schema name comparator
    • Constructor Detail

      • SchemaName

        public SchemaName​(Name schemaName)
        Constructs a properly escaped non-qualified SchemaName from a Name
        Parameters:
        schemaName - A non-qualified escaped schema name
      • SchemaName

        public SchemaName​(java.lang.String schemaName)
        Constructs a properly escaped non-qualified SchemaName.

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

        Parameters:
        schemaName - A non-qualified unescaped schema name.
      • SchemaName

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

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

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

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

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

        public SchemaName​(java.lang.String databaseName,
                          java.lang.String schemaName)
        Constructs a properly escaped qualified SchemaName.
        Parameters:
        databaseName - An unescaped databaseName
        schemaName - An unescaped schema 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 Database name prefix
        Returns:
        The 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 schema name is qualified i.e Whether the schema name has a database name prefix
        Returns:
        Whether the schema name fully qualified
      • equals

        public boolean equals​(java.lang.Object that)
        Checks two names 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​(SchemaName other)
        Compares this name with the other schema name for order.
        Specified by:
        compareTo in interface java.lang.Comparable<SchemaName>
        Parameters:
        other - The other 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