org.geotools.util
Class ScopedName

Object
  extended by GenericName
      extended by ScopedName
All Implemented Interfaces:
Serializable, Comparable<GenericName>, GenericName, ScopedName

public class ScopedName
extends GenericName
implements 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, as tail.

Since:
2.1
Author:
Martin Desruisseaux (IRD)
See Also:
NameFactory, Serialized Form
Module:

Field Summary
 
Fields inherited from class GenericName
DEFAULT_SEPARATOR
 
Constructor Summary
ScopedName(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
 ScopedName asScopedName()
          Deprecated. Replaced by toFullyQualifiedName().
 boolean equals(Object object)
          Compares this scoped name with the specified object for equality.
 List<LocalName> getParsedNames()
          Returns the sequence of local name for this generic name.
 GenericName getScope()
          Deprecated. Replaced by GenericName.scope().
 char getSeparator()
          Returns the separator character.
 int hashCode()
          Returns a hash code value for this generic name.
 LocalName head()
          Returns the head of this scoped name.
 LocalName name()
          Deprecated. Replaced by name.
 GenericName path()
          Returns a name which contains every element of the parsed names list except for the last element.
 ScopedName push(GenericName scope)
          Returns this name expanded with the specified scope.
 GenericName tail()
          Returns the tail of this scoped name.
 GenericName toFullyQualifiedName()
          Returns a view of this name as a fully-qualified name.
 
Methods inherited from class GenericName
asLocalName, compareTo, depth, scope, tip, toInternationalString, toString
 
Methods inherited from class Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface ScopedName
toString
 
Methods inherited from interface GenericName
asLocalName, depth, scope, toInternationalString
 
Methods inherited from interface Comparable
compareTo
 

Constructor Detail

ScopedName

public ScopedName(GenericName scope,
                  CharSequence name)
Constructs a scoped name from the specified international string. If the specified name is an InternationalString, then the toString(null) method will be used in order to fetch an unlocalized name. Otherwise, the toString() method will be used.

Parameters:
scope - The scope (or "tail") of the variable.
name - The head (never null).

ScopedName

public ScopedName(GenericName scope,
                  char separator,
                  CharSequence name)
Constructs a scoped name from the specified international string. If the specified name is an InternationalString, then the toString(null) method will be used in order to fetch an unlocalized name. Otherwise, the toString() method will be used.

Parameters:
scope - The scope (or "tail") of the variable.
separator - The separator character (usually ':' or '/').
name - The head (never null).
Method Detail

head

public LocalName 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:

Specified by:
head in interface ScopedName
Overrides:
head in class GenericName
Returns:
The first element of this name.
Since:
2.3

tail

public GenericName 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:

Note: This condition can be understood in terms of the Java equals method instead of the Java identity comparator ==.

Specified by:
tail in interface ScopedName
Since:
2.3

path

public GenericName path()
Returns a name which contains every element of the parsed names list except for the last element.

Specified by:
path in interface ScopedName
Since:
2.3
See Also:
File.getPath()

getScope

@Deprecated
public GenericName getScope()
Deprecated. Replaced by GenericName.scope().

Returns the scope of this name.

Specified by:
getScope in interface GenericName
Specified by:
getScope in class GenericName
Returns:
The name space of this name.

getSeparator

public char getSeparator()
Returns the separator character.


asScopedName

@Deprecated
public ScopedName asScopedName()
Deprecated. Replaced by toFullyQualifiedName().

Returns a view of this object as a scoped name. Since this object is already a scoped name, this method always returns this.

Specified by:
asScopedName in interface GenericName
Specified by:
asScopedName in class GenericName
Returns:
The fully-qualified name.

name

@Deprecated
public LocalName name()
Deprecated. Replaced by name.

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 by LocalName.toString() will differs.

Specified by:
name in interface GenericName
Specified by:
name in interface ScopedName
Specified by:
name in class GenericName
Returns:
The last element of this name.
See Also:
LocalName.name, name

getParsedNames

public List<LocalName> getParsedNames()
Returns the sequence of local name for this generic name.

Specified by:
getParsedNames in interface GenericName
Specified by:
getParsedNames in class GenericName
Returns:
The sequence of local names.

toFullyQualifiedName

public GenericName 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 returns null.

Specified by:
toFullyQualifiedName in interface GenericName
Since:
2.3

push

public ScopedName push(GenericName scope)
Returns this name expanded with the specified scope. One may represent this operation as a concatenation of the specified name with this. In pseudo-code, the following relationships must hold:

Note: Those conditions can be understood in terms of the Java equals method instead of the Java identity comparator ==.

Specified by:
push in interface GenericName
Since:
2.3

equals

public boolean equals(Object object)
Compares this scoped name with the specified object for equality.

Overrides:
equals in class GenericName
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 GenericName


Copyright © 1996-2009 Geotools. All Rights Reserved.