Class GenericName

    • Field Detail

      • DEFAULT_SEPARATOR

        public static final char DEFAULT_SEPARATOR
        The default separator character.
        See Also:
        Constant Field Values
    • Constructor Detail

      • GenericName

        protected GenericName()
        Creates a new instance of generic name.
    • Method Detail

      • scope

        public NameSpace scope()
        Returns the scope (name space) in which this name is local. The scope is set on creation and is not modifiable. The scope of a name determines where a name "starts". For instance, if a name has a depth of two ("util.GenericName") and is associated with a name space having the name "org.opengis", then the fully qualified name would be "org.geotools.api.util.GenericName".
        Specified by:
        scope in interface GenericName
        Returns:
        The name space.
        Since:
        2.3
      • getInternalScope

        protected abstract GenericName getInternalScope()
        Returns the scope (name space) of this generic name. If this name has no scope (e.g. is the * root), then this method returns null. Can be a no-op if the subclass overrides scope()
      • depth

        public int depth()
        Returns the depth of this name within the namespace hierarchy. This indicates the number of levels specified by this name. For any LocalName, it is always one. For a ScopedName it is some number greater than or equal to 2.

        The depth is the length of the list returned by the getParsedNames() method. As such it is a derived parameter.

        Specified by:
        depth in interface GenericName
        Returns:
        The depth of this name.
        Since:
        2.3
      • getParsedNames

        public abstract List<LocalName> getParsedNames()
        Returns the sequence of local names making this generic name. Each element in this list is like a directory name in a file path name. The length of this sequence is the generic name depth.
        Specified by:
        getParsedNames in interface GenericName
        Returns:
        The sequence of local names.
      • head

        public LocalName head()
        Returns the first element in the sequence of parsed names. For any LocalName, this is always this.
        Specified by:
        head in interface GenericName
        Returns:
        The first element of this name.
        Since:
        2.6
      • tip

        public LocalName tip()
        Returns the last element in the sequence of parsed names. For any LocalName, this is always this.
        Specified by:
        tip in interface GenericName
        Returns:
        The last element of this name.
        Since:
        2.6
      • toString

        public String toString()
        Returns a string representation of this generic name. This string representation is local-independant. It contains all elements listed by getParsedNames() separated by an arbitrary character (usually : or /). This rule implies that the toString() method for a scoped name will contains the scope, while the toString() method for the local version of the same name will not contains the scope.
        Specified by:
        toString in interface GenericName
        Overrides:
        toString in class Object
        Returns:
        A string representation of this name.
      • toInternationalString

        public InternationalString toInternationalString()
        Returns a local-dependent string representation of this generic name. This string is similar to the one returned by toString() except that each element has been localized in the specified locale. If no international string is available, then this method should returns an implementation mapping to toString() for all locales.
        Specified by:
        toInternationalString in interface GenericName
        Returns:
        A localizable string representation of this name.
      • compareTo

        public int compareTo​(GenericName that)
        Compares this name with the specified object for order. Returns a negative integer, zero, or a positive integer as this name lexicographically precedes, is equals to, or follows the specified object. The comparaison is performed in the following order:
        • Compares each element in the list of parsed names. If an element of this name lexicographically precedes or follows the corresponding element of the specified name, returns a negative or a positive integer respectively.
        • If all elements in both names are lexicographically equal, then if this name has less or more elements than the specified name, returns a negative or a positive integer respectively.
        • Otherwise, returns 0.
        Specified by:
        compareTo in interface Comparable<GenericName>
        Parameters:
        that - The name to compare with this name.
        Returns:
        -1 if this name precedes the given one, +1 if it follows, 0 if equals.
      • equals

        public boolean equals​(Object object)
        Compares this generic name with the specified object for equality.
        Overrides:
        equals in class Object
        Parameters:
        object - The object to compare with this name.
        Returns:
        true if the given object is equals to this one.
      • hashCode

        public int hashCode()
        Returns a hash code value for this generic name.
        Overrides:
        hashCode in class Object