org.geotools.feature
Class NameImpl

java.lang.Object
  extended by org.geotools.feature.NameImpl
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable<NameImpl>, org.opengis.feature.type.Name

public class NameImpl
extends java.lang.Object
implements org.opengis.feature.type.Name, java.io.Serializable, java.lang.Comparable<NameImpl>

Simple implementation of Name.

This class emulates QName, and is used as the implementation of both AttributeName and TypeName (so when the API settles down we should have a quick fix.

Its is advantageous to us to be able to:

The ISO interface move towards combining the AttributeName and Attribute classes, and TypeName and Type classes, while we understand the attractiveness of this on a UML diagram it is very helpful to keep these concepts separate when playing with a strongly typed language like java.

It case it is not obvious this is a value object and equality is based on namespace and name.

Author:
Justin Deoliveira, The Open Planning Project, jdeolive@openplans.org
See Also:
Serialized Form

Field Summary
protected  java.lang.String local
          local part
protected  java.lang.String namespace
          namespace / scope
 
Constructor Summary
NameImpl(java.lang.String local)
          Constructs an instance with the local part set.
NameImpl(java.lang.String namespace, java.lang.String local)
          Constructs an instance with the local part and namespace set.
NameImpl(java.lang.String namespace, java.lang.String separator, java.lang.String local)
          Constructs an instance with the local part and namespace set.
 
Method Summary
 int compareTo(NameImpl other)
           
 boolean equals(java.lang.Object obj)
          value object with equality based on name and namespace.
 java.lang.String getLocalPart()
           
 java.lang.String getNamespaceURI()
           
 java.lang.String getSeparator()
           
 java.lang.String getURI()
           
 int hashCode()
          Returns a hash code value for this operand.
 boolean isGlobal()
           
 java.lang.String toString()
          name or namespace:name
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

namespace

protected java.lang.String namespace
namespace / scope


local

protected java.lang.String local
local part

Constructor Detail

NameImpl

public NameImpl(java.lang.String local)
Constructs an instance with the local part set. Namespace / scope is set to null.

Parameters:
local - The local part of the name.

NameImpl

public NameImpl(java.lang.String namespace,
                java.lang.String local)
Constructs an instance with the local part and namespace set.

Parameters:
namespace - The namespace or scope of the name.
local - The local part of the name.

NameImpl

public NameImpl(java.lang.String namespace,
                java.lang.String separator,
                java.lang.String local)
Constructs an instance with the local part and namespace set.

Parameters:
namespace - The namespace or scope of the name.
local - The local part of the name.
Method Detail

isGlobal

public boolean isGlobal()
Specified by:
isGlobal in interface org.opengis.feature.type.Name

getSeparator

public java.lang.String getSeparator()
Specified by:
getSeparator in interface org.opengis.feature.type.Name

getNamespaceURI

public java.lang.String getNamespaceURI()
Specified by:
getNamespaceURI in interface org.opengis.feature.type.Name

getLocalPart

public java.lang.String getLocalPart()
Specified by:
getLocalPart in interface org.opengis.feature.type.Name

getURI

public java.lang.String getURI()
Specified by:
getURI in interface org.opengis.feature.type.Name

hashCode

public int hashCode()
Returns a hash code value for this operand.

Specified by:
hashCode in interface org.opengis.feature.type.Name
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)
value object with equality based on name and namespace.

Specified by:
equals in interface org.opengis.feature.type.Name
Overrides:
equals in class java.lang.Object

toString

public java.lang.String toString()
name or namespace:name

Specified by:
toString in interface org.opengis.feature.type.Name
Overrides:
toString in class java.lang.Object

compareTo

public int compareTo(NameImpl other)
Specified by:
compareTo in interface java.lang.Comparable<NameImpl>


Copyright © 1996-2010 Geotools. All Rights Reserved.