org.geotools.feature
Class NameImpl

Object
  extended by NameImpl
All Implemented Interfaces:
Name

public class NameImpl
extends Object
implements Name

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

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

Field Detail

namespace

protected String namespace
namespace / scope


local

protected String local
local part

Constructor Detail

NameImpl

public NameImpl(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(String namespace,
                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 Name

getNamespaceURI

public String getNamespaceURI()
Specified by:
getNamespaceURI in interface Name

getLocalPart

public String getLocalPart()
Specified by:
getLocalPart in interface Name

getURI

public String getURI()
Specified by:
getURI in interface Name

hashCode

public int hashCode()
value object with equality based on name and namespace.

Specified by:
hashCode in interface Name
Overrides:
hashCode in class Object

equals

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

Specified by:
equals in interface Name
Overrides:
equals in class Object

toString

public String toString()
name or namespace:name

Specified by:
toString in interface Name
Overrides:
toString in class Object


Copyright © 1996-2009 Geotools. All Rights Reserved.