@UML(identifier="GenericName", specification=ISO_19103) public interface GenericName extends Comparable<GenericName>
Name
from the Java Naming and
Directory Interface. All generic names:
Names are immutables. They may be fully qualified
like "org.opengis.util.Record"
, or they may be relative to a scope
like "util.Record"
in the "org.opengis"
scope. The illustration below shows all
possible constructions for "org.opengis.util.Record"
.
org . opengis . util . Record scope()
getParsedNames()
head tail global {"org", "opengis", "util", "Record"} path tip ScopedName scope head tail "org" {"opengis", "util", "Record"} path tip ScopedName scope head tail "org.opengis" {"util", "Record"} path tip ScopedName scope head "org.opengis.util" {"Record"} tip LocalName
The natural ordering for generic names is implementation dependent. A recommended practice is to compare lexicographically each element in the list of parsed names. Specific attributes of the name, such as how it treats case, may affect the ordering. In general, two names of different classes may not be compared.
Name
Modifier and Type | Method and Description |
---|---|
int |
depth()
Indicates the number of levels specified by this name.
|
List<? extends LocalName> |
getParsedNames()
Returns the sequence of local names making this generic name.
|
LocalName |
head()
Returns the first element in the sequence of parsed names.
|
LocalName |
name()
Deprecated.
Renamed as
tip() . |
ScopedName |
push(GenericName scope)
Returns this name expanded with the specified scope.
|
NameSpace |
scope()
Returns the scope (name space) in which this name is local.
|
LocalName |
tip()
Returns the last element in the sequence of parsed names.
|
GenericName |
toFullyQualifiedName()
Returns a view of this name as a fully-qualified name.
|
InternationalString |
toInternationalString()
Returns a local-dependent string representation of this generic name.
|
String |
toString()
Returns a string representation of this generic name.
|
compareTo
@UML(identifier="scope", obligation=MANDATORY, specification=ISO_19103) NameSpace scope()
Example: For a fully qualified name (a name
having a global namespace) "org.opengis.util.Record"
,
if this instance is the name "util.Record"
, then the scope of this instance has the
name "org.opengis"
.
@UML(identifier="depth", obligation=MANDATORY, specification=ISO_19103) int depth()
getParsedNames()
method. As such it is a derived
parameter. For any LocalName
, it is always one. For a ScopedName
it is some
number greater than or equal to 2.
This method is similar in purpose to Name.size()
from the Java
Naming and Directory Interface.
Example: If this
name is "org.opengis.util.Record"
, then this
method shall returns 4
. If this name is "util.Record"
in scope "org.opengis"
, then this method shall returns 2
.
@UML(identifier="parsedName", obligation=MANDATORY, specification=ISO_19103) List<? extends LocalName> getParsedNames()
This method is similar in purpose to Name.getAll()
from the
Java Naming and Directory Interface.
Example: If this
name is "org.opengis.util.Record"
, then this
method shall returns a list containing {"org", "opengis", "util", "Record"}
elements
in that iteration order. If this name is "util.Record"
in scope "org.opengis"
, then this method shall returns a list containing only {"util",
"Record"}
elements.
@UML(identifier="ScopedName.head", obligation=MANDATORY, specification=ISO_19103) LocalName head()
LocalName
, this is always this
.
This method is similar in purpose to Name.get(0)
from the Java Naming and Directory Interface.
Example: If this
name is "org.opengis.util.Record"
(no matter its
scope), then this method shall returns "org"
.
@Extension LocalName tip()
LocalName
, this is always this
.
This method is similar in purpose to Name.get(size-1)
from the Java Naming and Directory Interface.
Example: If this
name is "org.opengis.util.Record"
(no matter its
scope), then this method shall returns "Record"
.
@Extension @Deprecated LocalName name()
tip()
.@Extension GenericName toFullyQualifiedName()
this
.
Example: If this
name is "util.Record"
(depth
of two) and its scope has the name "org.opengis"
, then the fully qualified name shall be "org.opengis.util.Record"
.
null
).@UML(identifier="push", obligation=MANDATORY, specification=ISO_19103) ScopedName push(GenericName scope)
scope
with this
. In pseudo-code, the following
relationships must hold (the last one is specific to ScopedName
):
push(
foo : LocalName).head()
equals foo
push(
foo : LocalName).tail()
equals this
push(
foo : GenericName).scope()
equals foo.scope()
push(
foo : GenericName).getParsedNames()
equals foo.
getParsedNames().addAll(
this.getParsedNames())
This method is similar in purpose to
Name.addAll(0,name)
from the Java Naming and Directory Interface.
Example: If this
name is "util.Record"
and the given scope
argument is "org.opengis"
, then this.push(scope)
shall returns "org.opengis.util.Record"
.
scope
- The name to use as prefix.@Extension String toString()
getParsedNames()
separated by a
namespace-dependant character (usually :
or /
). This rule implies that the
result may or may not be fully qualified. Special cases:
toFullyQualifiedName().toString()
is garanteed to contains the
scope (if any).
name().toString()
is garanteed to not
contains any scope.
@Extension InternationalString toInternationalString()
toString()
except that each element has been localized in the
specified locale. If no
international string is available, then this method shall returns an implementation mapping
to toString()
for all locales.
Example: An implementation may want to localize the "My Documents"
directory name into "Mes Documents"
on French installation of Windows operating
system.
Copyright © 1996–2019 Geotools. All rights reserved.