org.geotools.util
Class LocalName

Object
  extended by GenericName
      extended by LocalName
All Implemented Interfaces:
Serializable, Comparable<GenericName>, GenericName, LocalName
Direct Known Subclasses:
MemberNameImpl

public class LocalName
extends GenericName
implements LocalName

Identifier within a name space for a local object. This could be the target object of the GenericName, or a pointer to another name space (with a new GenericName) one step closer to the target of the identifier.

Since:
2.1
Author:
Martin Desruisseaux (IRD)
See Also:
NameFactory, Serialized Form
Module:
modules/library/metadata (gt-metadata.jar)

Field Summary
 
Fields inherited from class GenericName
DEFAULT_SEPARATOR
 
Constructor Summary
LocalName(CharSequence name)
          Constructs a local name from the specified string with no scope.
 
Method Summary
 ScopedName asScopedName()
          Deprecated. Replaced by toFullyQualifiedName().
 int compareTo(GenericName object)
          Compares this name with the specified object for order.
 int depth()
          Returns the depth, which is always 1 for a local name.
 boolean equals(Object object)
          Compares this local 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 scope().
 int hashCode()
          Returns a hash code value for this local name.
 LocalName head()
          Since this object is already a local name, this method always returns this.
 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()
          Since this object is already a local name, this method always returns this.
 GenericName toFullyQualifiedName()
          Returns a view of this name as a fully-qualified name.
 InternationalString toInternationalString()
          Returns a local-dependent string representation of this locale name.
 String toString()
          Returns a locale-independant string representation of this local name.
 
Methods inherited from class GenericName
asLocalName, name
 
Methods inherited from class Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface GenericName
name
 

Constructor Detail

LocalName

public LocalName(CharSequence name)
Constructs a local name from the specified string with no scope. 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:
name - The local name (never null).
Method Detail

getScope

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

Returns the scope (name space) of this generic name.

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

scope

public NameSpace 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". For instance, if a name has a depth of two ("util.GenericName") and is associated with a name space having the name "org.opengis", then the fully qualified name would be "org.opengis.util.GenericName".

Specified by:
scope in interface GenericName
Overrides:
scope in class GenericName
Returns:
The name space.
Since:
2.3

depth

public int depth()
Returns the depth, which is always 1 for a local name.

Specified by:
depth in interface GenericName
Specified by:
depth in interface LocalName
Overrides:
depth in class GenericName
Returns:
The depth of this name.
Since:
2.3

getParsedNames

public List<LocalName> getParsedNames()
Returns the sequence of local name for this generic name. Since this object is itself a locale name, this method always returns a singleton containing only this.

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

head

public LocalName head()
Since this object is already a local name, this method always returns this.

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

tip

public LocalName tip()
Since this object is already a local name, this method always returns this.

Specified by:
tip in interface GenericName
Specified by:
tip in interface LocalName
Overrides:
tip in class GenericName
Returns:
The last element of this name.

asScopedName

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

Returns a view of this object as a scoped name, or null if this name has no scope.

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

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

toString

public String toString()
Returns a locale-independant string representation of this local name. This string do not includes the scope, which is consistent with the parsed names definition.

Specified by:
toString in interface GenericName
Specified by:
toString in interface LocalName
Overrides:
toString in class GenericName
Returns:
A string representation of this name.

toInternationalString

public InternationalString toInternationalString()
Returns a local-dependent string representation of this locale name.

Specified by:
toInternationalString in interface GenericName
Overrides:
toInternationalString in class GenericName
Returns:
A localizable string representation of this name.

compareTo

public int compareTo(GenericName object)
Compares this name with the specified object for order. Returns a negative integer, zero, or a positive integer as this name lexicographically precedes, is equals to, or follows the specified object. The comparaison is case-insensitive.

Specified by:
compareTo in interface Comparable<GenericName>
Overrides:
compareTo in class GenericName
Parameters:
object - The name to compare with this name.
Returns:
-1 if this name precedes the given one, +1 if it follows, 0 if equals.

equals

public boolean equals(Object object)
Compares this local 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 local name.

Overrides:
hashCode in class GenericName


Copyright © 1996-2009 Geotools. All Rights Reserved.