Interface Name

  • All Known Implementing Classes:
    AppSchemaDataAccessConfigurator.ComplexNameImpl, GeometryOperand, NameImpl

    public interface Name
    A qualified Name (with respect to a namespace rather than just a simple prefix).

    This interface provides method names similar to the Java QName interface in order to facilitate those transition from an XML models. We are recording the a full namespace (rather than just a prefix) in order to sensibly compare Names produced from different contexts. Since the idea of a "prefix" in a QName is only used to refer to a namespace defined earlier in the document it is sensible for us to ask this prefix be resolved (allowing us to reliability compare names produced from different documents; or defined by different repositories). Notes:

    • You should not need to use the "separator" when working with Name as a programmer. There is no need to do a string concatenation; just compare getNamespaceURI() and compare getLocalPart(). Do not build a lot of strings to throw away.
    • prefix: If you need to store the prefix information please make use of "client properties" facilities located on PropertyType data structure. The prefix is not a logical part of a Name; but often it is nice to preserve prefix when processing data in order not to disrupt other components in a processing chain.
    • Name is to be understood with respect to its getNamespaceURI(), if needed you make look up a Namespace using this information. This is however not a backpointer (Name does not require a Namespace to be constructed) and the lookup mechanism is not specified, indeed we would recommend the use of JNDI , and we suspect that the Namespace should be lazily created as required.
    • Name may also be "global" in which case the getNamespaceURI() is null, we have made a test for this case explicit with the isGlobal() method.
    Name is a lightweight data object with identity (equals method) based on getNameSpaceURI() and getLocalPart() information. This interface is strictly used for identification and should not be extended to express additional functionality.
    Author:
    Jody Garnett (Refractions Research, Inc.)
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      boolean equals​(Object obj)
      true if getURI is equal.
      String getLocalPart()
      Retrieve the "local" name.
      String getNamespaceURI()
      Returns the URI of the namespace for this name.
      String getSeparator()
      Separator to use between getNamespaceURI() and getLocalPart() when constructing getURI().
      String getURI()
      Convert this name to a complete URI.
      int hashCode()
      Must be based on getURI().
      boolean isGlobal()
      Returns true if getNamespaceURI is null
      String toString()
      A local-independent representation of this name, see getURI().
    • Method Detail

      • isGlobal

        boolean isGlobal()
        Returns true if getNamespaceURI is null
        Returns:
        Returns true if getNamespaceURI is null
      • getNamespaceURI

        String getNamespaceURI()
        Returns the URI of the namespace for this name.

        In ISO 19103 this is known as scope and containes a backpointer to the containing namespace. This solution is too heavy for our purposes, and we expect applications to provide their own lookup mechanism through which they can use this URI. The namespace URI does serve to make this name unique and is checked as part of the equals operation.

        Since:
        GeoAPI 2.1
      • getSeparator

        String getSeparator()
        Separator to use between getNamespaceURI() and getLocalPart() when constructing getURI().

        This separator is only used to construct a visually pleasing getURI() result. The value to use as a separator depends on the registry or namespace you are working with. JNDI naming services have been known to use "/" and ":". Referring to an element in an XMLSchema document has been represented with a "#" symbol.

        Returns:
        A separator (such as "/" or ":").
      • getLocalPart

        String getLocalPart()
        Retrieve the "local" name.

        This mechanism captures the following ISO 19103 concerns:

        • GenericName.depth(): this concept is not interesting, we assume a namespace would be able to navigate through contained namespace on its own based on this local part.
        • GenericName.asLocalName()
        • GenericName.name()
        Returns:
        local name (can be used in namespace lookup)
      • getURI

        String getURI()
        Convert this name to a complete URI.

        This URI is constructed with the getNamespaceURI(), getSeparator() and getLocalPart().

        This method captures the following concerns of ISO 19103 concerns:

        • GenericName.getParsedNames()
        • toFullyQuantifiedName()

        As an example:

        • namespace: "gopher://localhost/example" separator: "/" local: "name"
        • namespace: "gopher://localhost" separator: "/" local: "example/name"
        Both return: "gopher://localhost/example/name" as they indicate the same entry in the namespace system (such as a Registry or JNDI naming service).
        Returns:
        a complete URI constructed of namespace URI and the local part.
      • hashCode

        int hashCode()
        Must be based on getURI().
        Overrides:
        hashCode in class Object
        Returns:
        a hascode based on getURI()
      • equals

        boolean equals​(Object obj)
        true if getURI is equal.
        Overrides:
        equals in class Object
        Returns:
        true if getURI is equal.
      • toString

        String toString()
        A local-independent representation of this name, see getURI().
        Overrides:
        toString in class Object