Class DefaultNameSpace

    • Field Detail

      • DEFAULT_SEPARATOR

        public static final char DEFAULT_SEPARATOR
        The default separator, which is ':'. The separator is inserted between the namespace and any generic name in that namespace.
        See Also:
        Constant Field Values
    • Constructor Detail

      • DefaultNameSpace

        protected DefaultNameSpace​(DefaultNameSpace parent,
                                   CharSequence name,
                                   String headSeparator,
                                   String separator)
        Creates a new namespace with the given separator.
        Parameters:
        parent - the parent namespace, or null if none.
        name - the name of the new namespace, usually as a String or an International­String.
        head­Separator - the separator to insert between the namespace and the head of any name in that namespace.
        separator - the separator to insert between the parsed names of any name in that namespace.
    • Method Detail

      • isGlobal

        public boolean isGlobal()
        Indicates whether this namespace is a "top level" namespace. Global, or top-level namespaces are not contained within another namespace. The global namespace has no parent.
        Specified by:
        is­Global in interface Name­Space
        Returns:
        true if this namespace is the global namespace.
      • name

        public GenericName name()
        Represents the identifier of this namespace. Namespace identifiers shall be fully-qualified names where the following condition holds:
        assert name.scope().isGlobal() == true;
        Specified by:
        name in interface Name­Space
        Returns:
        the identifier of this namespace.
      • toString

        public String toString()
        Returns a JCR-like lexical form representation of this namespace. Following the Java Content Repository (JCR) convention, this method returns the string representation of name() between curly brackets.
        Example: if the name of this namespace is “org​.apache​.sis”, then this method returns “{org​.apache​.sis}”.
        Usage
        With this convention, it would be possible to create an expanded form of a generic name (except for escaping of illegal characters) with a simple concatenation as in the following code example:
        GenericName name = ...; // A name
        println("Expanded form = " + name.scope() + name);
        However the convention followed by this Default­Name­Space implementation is not specified in the Name­Space contract. This implementation follows the JCR convention for debugging convenience, but applications needing better guarantees should use Names​.to­Expanded­String(Generic­Name) instead.
        Overrides:
        to­String in class Object
        Returns:
        a JCR-like lexical form of this namespace.
        See Also:
        Names​.to­Expanded­String(Generic­Name)
      • equals

        public boolean equals​(Object object)
        Returns true if this namespace is equal to the given object.
        Overrides:
        equals in class Object
        Parameters:
        object - the object to compare with this namespace.
        Returns:
        true if the given object is equal to this namespace.
      • hashCode

        public int hashCode()
        Returns a hash code value for this namespace.
        Overrides:
        hash­Code in class Object