Class DatabaseName

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

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

      Constructors 
      Constructor Description
      DatabaseName​(Name databaseName)
      Constructs a Database name from already properly escaped SQL Name
      DatabaseName​(java.lang.String databaseName)
      Constructs a properly escaped Database Name.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int compareTo​(DatabaseName other)
      Compares this name with the other database name for order.
      boolean equals​(java.lang.Object that)
      Checks two names for equality.
      Name getName()
      Gets the database name
      int hashCode()
      Computes a hash code.
      java.lang.String toString()
      Gets a correctly escaped string representation of database name, which can be used in a SQL query to refer to the database entity
      • Methods inherited from class java.lang.Object

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

      • nullSafeDatabaseNameComparator

        public static java.util.Comparator<DatabaseName> nullSafeDatabaseNameComparator
        The null safe comparator
    • Constructor Detail

      • DatabaseName

        public DatabaseName​(java.lang.String databaseName)
        Constructs a properly escaped Database Name.

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

        Parameters:
        databaseName - An unescaped database name.
      • DatabaseName

        public DatabaseName​(Name databaseName)
        Constructs a Database name from already properly escaped SQL Name
        Parameters:
        databaseName - The database name
    • Method Detail

      • toString

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

        public Name getName()
        Gets the database name
        Returns:
        The name
      • 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​(DatabaseName other)
        Compares this name with the other database name for order.
        Specified by:
        compareTo in interface java.lang.Comparable<DatabaseName>
        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