org.geotools.util
Class ScopedName

java.lang.Object
  extended by org.geotools.util.GenericName
      extended by org.geotools.util.ScopedName
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable<org.opengis.util.GenericName>, org.opengis.util.GenericName, org.opengis.util.ScopedName

public class ScopedName
extends GenericName
implements org.opengis.util.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
Version:
$Id: ScopedName.java 31177 2008-08-13 22:09:25Z desruisseaux $
Author:
Martin Desruisseaux (IRD)
See Also:
NameFactory, Serialized Form

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

Constructor Detail

ScopedName

public ScopedName(org.opengis.util.GenericName scope,
                  java.lang.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(org.opengis.util.GenericName scope,
                  char separator,
                  java.lang.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 org.opengis.util.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 org.opengis.util.GenericName
Specified by:
head in interface org.opengis.util.ScopedName
Overrides:
head in class GenericName
Returns:
The first element of this name.
Since:
2.3

tail

public org.opengis.util.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 org.opengis.util.ScopedName
Since:
2.3

path

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

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

getScope

@Deprecated
public org.opengis.util.GenericName getScope()
Deprecated. Replaced by GenericName.scope().

Returns the scope of this name.

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

getSeparator

public char getSeparator()
Returns the separator character.


asScopedName

@Deprecated
public org.opengis.util.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 class GenericName
Returns:
The fully-qualified name.

tip

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

Specified by:
tip in interface org.opengis.util.GenericName
Specified by:
tip in interface org.opengis.util.ScopedName
Overrides:
tip in class GenericName
Returns:
The last element of this name.

getParsedNames

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

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

toFullyQualifiedName

public org.opengis.util.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 org.opengis.util.GenericName
Since:
2.3

push

public org.opengis.util.ScopedName push(org.opengis.util.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 org.opengis.util.GenericName
Since:
2.3

equals

public boolean equals(java.lang.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-2010 Geotools. All Rights Reserved.