Interface GenericName

All Superinterfaces:
Comparable<GenericName>
All Known Subinterfaces:
LocalName, MemberName, ScopedName, TypeName

A sequence of identifiers rooted within the context of a namespace. The job of a "name" is to associate that name with an Object. For example, GenericName instances could be keys in a HashMap, in which case the namespace is materialized by the HashMap. Names are often used in the context of reading data from various formats such as XML, shapefiles or netCDF, which have different constraints for names in their namespaces. When reading data from a file, names are often used for identifying attributes in records. In such case, specialized types are used: Names can be fully qualified (e.g. "urn:ogc:def:crs:EPSG::4326") or relative to a scope (e.g. "EPSG::4326" in the "urn:ogc:def:crs" namespace). All names have the ability to provide a parsed version of themselves. In the following illustration, each line is one possible construction for "urn:crs:epsg:4326" (taken as an abridged form of above URN for this example only). For each construction:
  • the part without colored background is the scope() and is invisible to all other methods except toFullyQualifiedName();
  • the first column shows the visible part of the name in a green background;
  • the second and third columns show the (head:tail) and (path:tip) components, respectively.
Various representations of a generic name
scope:name head:tail path:tip Type
urn:crs:epsg:4326 urn:crs:epsg:4326 urn:crs:epsg:4326 ScopedName with global namespace
urn:crs:epsg:4326 urn:crs:epsg:4326 urn:crs:epsg:4326 ScopedName
urn:crs:epsg:4326 urn:crs:epsg:4326 urn:crs:epsg:4326 ScopedName
urn:crs:epsg:4326 urn:crs:epsg:4326 urn:crs:epsg:4326 LocalName

Comparison with files in a filesystem

This GenericName interface is similar to a file path in a file system relative to a default directory. It can be compared to the standard Path interface in the JDK:
Equivalence between GenericName and java.nio.file.Path
GeoAPI Name method Equivalent Java I/O method
scope() Default directory
ScopedName.path() Path.getParent()
tip() Path.getFileName()
toFullyQualifiedName() Path.toAbsolutePath()
depth() Path.getNameCount()
getParsedNames() Path.iterator()
compareTo(GenericName) Path.compareTo(Path)
toString() Path.toString()

Comparison with Java Content Repository (JCR) names

In the Java standard QName class and in the Java Content Repository (JCR) specification, a name is an ordered pair of (Name space, Local part) strings. A JCR name can take two lexical forms: expanded form and qualified form. Those names are defined as:
Equivalence between JCR name and GenericName
JCR name definition GeoAPI equivalence
ExpandedName ::= '{' Namespace '}' LocalPart GenericName.scope().name().toString() = JCR Namespace
GenericName.toString() = JCR LocalPart
QualifiedName ::= [Prefix ':'] LocalPart ScopedName.scope() = global namespace
ScopedName.head().toString() = JCR Prefix
ScopedName.tail().toString() = JCR LocalPart
Since:
1.0
See Also: