Package org.geotools.util
Class ScopedName
Object
GenericName
ScopedName
- All Implemented Interfaces:
Serializable
,Comparable<GenericName>
,GenericName
,ScopedName
Fully qualified identifier for an object. A
ScopedName
contains a LocalName
as
head and a GenericName, which may be a LocalName
or an other
ScopedName
.- Since:
- 2.1
- Author:
- Martin Desruisseaux (IRD)
- See Also:
-
Field Summary
Fields inherited from class GenericName
DEFAULT_SEPARATOR
-
Constructor Summary
ConstructorsConstructorDescriptionScopedName
(GenericName scope, char separator, CharSequence name) Constructs a scoped name from the specified international string.ScopedName
(GenericName scope, CharSequence name) Constructs a scoped name from the specified international string. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Compares this scoped name with the specified object for equality.protected GenericName
Returns the scope (name space) of this generic name.Returns the sequence of local name for this generic name.char
Returns the separator character.int
hashCode()
Returns a hash code value for this generic name.head()
Returns the head of this scoped name.path()
Returns a name which contains every element of the parsed names list except for the last element.push
(GenericName scope) Returns this name expanded with the specified scope.tail()
Returns the tail of this scoped name.tip()
Returns a view of this object as a local name.Returns a view of this name as a fully-qualified name.Methods inherited from class GenericName
compareTo, depth, scope, toInternationalString, toString
Methods inherited from interface Comparable
compareTo
Methods inherited from interface GenericName
depth, scope, toInternationalString
Methods inherited from interface ScopedName
toString
-
Constructor Details
-
ScopedName
Constructs a scoped name from the specified international string. If the specified name is anInternationalString
, then thetoString(null)
method will be used in order to fetch an unlocalized name. Otherwise, thetoString()
method will be used.- Parameters:
scope
- The scope (or "tail") of the variable.name
- The head (nevernull
).
-
ScopedName
Constructs a scoped name from the specified international string. If the specified name is anInternationalString
, then thetoString(null)
method will be used in order to fetch an unlocalized name. Otherwise, thetoString()
method will be used.- Parameters:
scope
- The scope (or "tail") of the variable.separator
- The separator character (usually':'
or'/'
).name
- The head (nevernull
).
-
-
Method Details
-
head
Returns the head of this scoped name. This is the first elements in the sequence of parsed names. The head element must exists in the same name space than this scoped name. In other words, the following relationship must holds:head().scope() == this.scope()
- Specified by:
head
in interfaceGenericName
- Specified by:
head
in interfaceScopedName
- Overrides:
head
in classGenericName
- Returns:
- The first element of this name.
- Since:
- 2.3
-
tail
Returns the tail of this scoped name. The returned name contains every elements of the parsed names list except for the first one, which is the head. In other words, the following relationship must holds:tail().getParsedNames() == this.getParsedNames().sublist(1,end)
Note: This condition can be understood in terms of the Java
equals
method instead of the Java identity comparator==
.- Specified by:
tail
in interfaceScopedName
- Returns:
- All elements except the first one in the in the list of parsed names.
- Since:
- 2.3
-
path
Returns a name which contains every element of the parsed names list except for the last element.- Specified by:
path
in interfaceScopedName
- Returns:
- All elements except the last one in the in the list of parsed names.
- Since:
- 2.3
- See Also:
-
getSeparator
public char getSeparator()Returns the separator character. -
tip
Returns a view of this object as a local name. This is the last element in the sequence of parsed names. The local name returned by this method will still have the same scope than this scoped name. Note however that the string returned byLocalName.toString()
will differs.- Specified by:
tip
in interfaceGenericName
- Specified by:
tip
in interfaceScopedName
- Overrides:
tip
in classGenericName
- Returns:
- The last element of this name.
-
getInternalScope
Description copied from class:GenericName
Returns the scope (name space) of this generic name. If this name has no scope (e.g. is the * root), then this method returnsnull
. Can be a no-op if the subclass overridesGenericName.scope()
- Specified by:
getInternalScope
in classGenericName
-
getParsedNames
Returns the sequence of local name for this generic name.- Specified by:
getParsedNames
in interfaceGenericName
- Specified by:
getParsedNames
in classGenericName
- Returns:
- The sequence of local names.
-
toFullyQualifiedName
Returns a view of this name as a fully-qualified name. The scope of a fully qualified name must be global. This method never returnsnull
.- Specified by:
toFullyQualifiedName
in interfaceGenericName
- Returns:
- The fully-qualified name (never
null
). - Since:
- 2.3
-
push
Returns this name expanded with the specified scope. One may represent this operation as a concatenation of the specifiedname
withthis
. In pseudo-code, the following relationships must hold:push(name).getParsedList() == name.getParsedList().addAll(getParsedNames())
push(name).scope() == name.GenericName.scope()
push(head()).tail() == this
Note: Those conditions can be understood in terms of the Java
equals
method instead of the Java identity comparator==
.- Specified by:
push
in interfaceGenericName
- Parameters:
scope
- The name to use as prefix.- Returns:
- A concatenation of the given name with this name.
- Since:
- 2.3
-
equals
Compares this scoped name with the specified object for equality.- Overrides:
equals
in classGenericName
- 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 classGenericName
-