Class Name

java.lang.Object
com.tableau.hyperapi.Name
All Implemented Interfaces:
Comparable<Name>

public final class Name extends Object implements Comparable<Name>
A name.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Name(String unescapedName)
    Constructs a properly escaped SQL name.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    compareTo(Name other)
    Compares this name with the specified name for order.
    boolean
    equals(Object that)
    Checks two names for equality.
    Returns the original unescaped name.
    int
    Computes a hash code.
    Gets a correctly escaped string representation of this name, which can be used in a SQL query to refer to the named entity.

    Methods inherited from class java.lang.Object

    getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • Name

      public Name(String unescapedName)
      Constructs a properly escaped SQL name.

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

      Parameters:
      unescapedName - An unescaped name.
  • Method Details

    • toString

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

      public String getUnescaped()
      Returns the original unescaped name.

      Don't use the result of this method in SQL, as it is prone to SQL injection. The method should be used for use-cases where the original name is more readable (e.g., logging).

      Returns:
      The original unescaped name; or empty if the name was created with `createUnescaped`.
    • equals

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

      public int compareTo(Name other)
      Compares this name with the specified name for order.
      Specified by:
      compareTo in interface Comparable<Name>
      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 Object