Class Namespace

java.lang.Object
org.apache.gravitino.Namespace

public class Namespace extends Object
A namespace is a sequence of levels separated by dots. It's used to identify a metalake, a catalog or a schema. For example, "metalake1", "metalake1.catalog1" and "metalake1.catalog1.schema1" are all valid namespaces.
  • Method Details

    • empty

      public static Namespace empty()
      Get an empty namespace.
      Returns:
      An empty namespace
    • of

      public static Namespace of(String... levels)
      Create a namespace with the given levels.
      Parameters:
      levels - The levels of the namespace
      Returns:
      A namespace with the given levels
    • fromString

      public static Namespace fromString(String namespace)
      Create a namespace with the given string with levels separated by dots.
      Parameters:
      namespace - The namespace string
      Returns:
      A namespace with the given levels
    • levels

      public String[] levels()
      Get the levels of the namespace.
      Returns:
      The levels of the namespace
    • level

      public String level(int pos)
      Get the level at the given position.
      Parameters:
      pos - The position of the level
      Returns:
      The level at the given position
    • length

      public int length()
      Get the length of the namespace.
      Returns:
      The length of the namespace.
    • isEmpty

      public boolean isEmpty()
      Check if the namespace is empty.
      Returns:
      True if the namespace is empty, false otherwise.
    • equals

      public boolean equals(Object other)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • check

      @FormatMethod public static void check(boolean expression, @FormatString String message, Object... args)
      Check the given condition is true. Throw an IllegalNamespaceException if it's not.
      Parameters:
      expression - The expression to check.
      message - The message to throw.
      args - The arguments to the message.