Class Namespace


  • @Immutable
    public abstract class Namespace
    extends Content
    For a given table name a.b.c.tableName, the Namespace would be the prefix a.b.c, since the last element tableName always represents the name of the actual table and is not included in the Namespace itself. Therefore, the Namespace is always consisting of the first N-1 elements.
    • Nested Class Summary

    • Field Summary

      Fields 
      Modifier and Type Field Description
      static Namespace EMPTY  
    • Constructor Summary

      Constructors 
      Constructor Description
      Namespace()  
    • Method Summary

      All Methods Static Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      static Namespace fromPathString​(java.lang.String encoded)
      Convert from path encoded string to normal string.
      abstract @NotNull java.util.List<java.lang.String> getElements()  
      abstract @NotNull java.util.Map<java.lang.String,​java.lang.String> getProperties()  
      Content.Type getType()
      Returns the Content.Type value for this content object.
      boolean isEmpty()  
      boolean isSameOrSubElementOf​(Namespace parent)
      Checks whether the current Namespace is the same as or a sub-element of the given Namespace instance by comparing each canonical element.
      @NotNull java.lang.String name()  
      static Namespace of​(java.lang.String... elements)
      Builds a Namespace instance for the given elements.
      static Namespace of​(java.util.List<java.lang.String> elements)
      Builds a Namespace instance for the given elements.
      static Namespace of​(java.util.List<java.lang.String> elements, java.util.Map<java.lang.String,​java.lang.String> properties)
      Builds a Namespace instance for the given elements and the given properties.
      static Namespace of​(java.util.Map<java.lang.String,​java.lang.String> properties, java.lang.String... elements)
      Builds a Namespace instance for the given elements and the given properties.
      static Namespace parse​(java.lang.String identifier)
      Builds a Namespace instance for the given elements split by the . (dot) character.
      java.lang.String toPathString()
      Convert this namespace to a URL encoded path string.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

    • Constructor Detail

      • Namespace

        public Namespace()
    • Method Detail

      • getType

        public Content.Type getType()
        Description copied from class: Content
        Returns the Content.Type value for this content object.

        The name of the returned value should match the JSON type name used for serializing the content object.

        Specified by:
        getType in class Content
      • name

        @NotNull
        @Derived
        public @NotNull java.lang.String name()
      • isEmpty

        @Redacted
        public boolean isEmpty()
      • getElements

        @NotNull
        public abstract @NotNull java.util.List<java.lang.String> getElements()
      • getProperties

        @NotNull
        public abstract @NotNull java.util.Map<java.lang.String,​java.lang.String> getProperties()
      • of

        public static Namespace of​(java.lang.String... elements)
        Builds a Namespace instance for the given elements.
        Parameters:
        elements - The elements to build the namespace from.
        Returns:
        The constructed Namespace instance. If elements is empty, then name() will be an empty string.
      • of

        public static Namespace of​(java.util.Map<java.lang.String,​java.lang.String> properties,
                                   java.lang.String... elements)
        Builds a Namespace instance for the given elements and the given properties.
        Parameters:
        elements - The elements to build the namespace from.
        properties - The namespace properties.
        Returns:
        The constructed Namespace instance. If elements is empty, then name() will be an empty string.
      • of

        public static Namespace of​(java.util.List<java.lang.String> elements)
        Builds a Namespace instance for the given elements.
        Parameters:
        elements - The elements to build the namespace from.
        Returns:
        The constructed Namespace instance. If elements is empty, then name() will be an empty string.
      • of

        public static Namespace of​(java.util.List<java.lang.String> elements,
                                   java.util.Map<java.lang.String,​java.lang.String> properties)
        Builds a Namespace instance for the given elements and the given properties.
        Parameters:
        elements - The elements to build the namespace from.
        properties - The properties of the namespace.
        Returns:
        The constructed Namespace instance. If elements is empty, then name() will be an empty string.
      • parse

        public static Namespace parse​(java.lang.String identifier)
        Builds a Namespace instance for the given elements split by the . (dot) character.
        Parameters:
        identifier - The identifier to build the namespace from.
        Returns:
        Splits the given identifier by . and returns a Namespace instance. If identifier is empty, then name() will be an empty string.
      • isSameOrSubElementOf

        public boolean isSameOrSubElementOf​(Namespace parent)
        Checks whether the current Namespace is the same as or a sub-element of the given Namespace instance by comparing each canonical element.
        Parameters:
        parent - Namespace instance to compare with.
        Returns:
        true if the current Namespace is the same as or a sub-element of the given Namespace instance by comparing each canonical element, false otherwise.
      • fromPathString

        public static Namespace fromPathString​(java.lang.String encoded)
        Convert from path encoded string to normal string.
        Parameters:
        encoded - Path encoded string
        Returns:
        Actual key.
      • toPathString

        public java.lang.String toPathString()
        Convert this namespace to a URL encoded path string.
        Returns:
        String encoded for path use.
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object