- All Superinterfaces:
Comparable<GenericName>
- All Known Subinterfaces:
LocalName
,MemberName
,ScopedName
,TypeName
Name
from the Java Naming
and Directory Interface. All generic names:
- carry an association with their scope in which they are considered local;
- have the ability to provide a parsed version of themselves.
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"
. They are all instances of
ScopedName
except the last one which is a LocalName
.
org . opengis . util . Record scope()
getParsedNames()
head tail global { "org"
,"opengis"
,"util"
,"Record"
}path tip org . opengis . util . Record scope head tail "org"
{ "opengis"
,"util"
,"Record"
}path tip org . opengis . util . Record scope head tail "org.opengis"
{ "util"
,"Record"
}path tip org . opengis . util . Record scope head "org.opengis.util"
{ "Record"
}tip
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.
- Since:
- 1.0
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionint
depth()
Indicates the number of levels specified by this name.Returns the sequence of local names making this generic name.head()
Returns the first element in the sequence of parsed names.push
(GenericName scope) Returns this name expanded with the specified scope.scope()
Returns the scope (name space) in which this name is local.tip()
Returns the last element in the sequence of parsed names.Returns a view of this name as a fully-qualified name.Returns a local-dependent string representation of this generic name.toString()
Returns a string representation of this generic name.Methods inherited from interface Comparable
compareTo
-
Method Details
-
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.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"
.- Returns:
- The scope of this name.
- Since:
- 2.1
-
depth
Indicates the number of levels specified by this name. The depth is the size of the list returned by thegetParsedNames()
method. As such it is a derived parameter. For anyLocalName
, it is always one. For aScopedName
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 returns4
. If this name is"util.Record"
in scope"org.opengis"
, then this method shall returns2
.- Returns:
- The depth of this name.
- Since:
- 2.1
-
getParsedNames
@UML(identifier="parsedName", obligation=MANDATORY, specification=ISO_19103) List<? extends LocalName> getParsedNames()Returns the sequence of local names making this generic name. The length of this sequence is the depth. It does not include the scope.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. -
head
Returns the first element in the sequence of parsed names. For anyLocalName
, this is alwaysthis
.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"
.- Returns:
- The first element in the list of parsed names.
- Since:
- 2.2
- Departure from OGC/ISO abstract specification:
Generalization by relaxation of ISO/OGC restriction
ISO defines this method inScopedName
only. GeoAPI defines it in the base class sinceLocalName
can return a sensible value for it. This reduces the need for casts.
-
tip
LocalName tip()Returns the last element in the sequence of parsed names. For anyLocalName
, this is alwaysthis
.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"
.- Returns:
- The last element in the list of parsed names.
- Since:
- 2.1
- Departure from OGC/ISO abstract specification:
Extension for convenience without introduction of new functionality
This method is not part of ISO specification. It does not provide any additional information compared to that accessible though the standard methods defined by ISO, but provides easier to access frequently requested information.
-
toFullyQualifiedName
GenericName toFullyQualifiedName()Returns a view of this name as a fully-qualified name. The scope of a fully qualified name must be global. If the scope of this name is already global, then this method shall returnsthis
.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"
.- Returns:
- The fully-qualified name (never
null
). - Since:
- 2.1
- Departure from OGC/ISO abstract specification:
Extension for convenience without introduction of new functionality
This method is not part of ISO specification. It does not provide any additional information compared to that accessible though the standard methods defined by ISO, but provides easier to access frequently requested information.
-
push
@UML(identifier="push", obligation=MANDATORY, specification=ISO_19103) ScopedName push(GenericName scope) Returns this name expanded with the specified scope. One may represent this operation as a concatenation of the specifiedscope
withthis
. In pseudo-code, the following relationships must hold (the last one is specific toScopedName
):push(
foo: LocalName).head()
equals foopush(
foo: LocalName).tail()
equals thispush(
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 givenscope
argument is"org.opengis"
, thenthis.push(scope)
shall returns"org.opengis.util.Record"
.- Parameters:
scope
- The name to use as prefix.- Returns:
- A concatenation of the given name with this name.
- Since:
- 2.1
-
toString
String toString()Returns a string representation of this generic name. This string representation is local-independent. It contains all elements listed bygetParsedNames()
separated by a namespace-dependent character (usually:
or/
). This rule implies that the result may or may not be fully qualified. Special cases:toFullyQualifiedName().toString()
is guaranteed to contains the scope (if any).tip().toString()
is guaranteed to not contains any scope.
- Overrides:
toString
in classObject
- Returns:
- A local-independent string representation of this name.
- Departure from OGC/ISO abstract specification:
Extension for convenience without introduction of new functionality
This method is not part of ISO specification. It does not provide any additional information compared to that accessible though the standard methods defined by ISO, but provides easier to access frequently requested information.
-
toInternationalString
InternationalString toInternationalString()Returns a local-dependent string representation of this generic name. This string is similar to the one returned bytoString()
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 totoString()
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.- Returns:
- A localizable string representation of this name.
- Departure from OGC/ISO abstract specification:
Addition of element not in the ISO/OGC specification
This method is not part of the ISO specification. It has been added to provide a way to localize the name.
-