com.ctc.wstx.dtd
Class NameKey

java.lang.Object
  extended by com.ctc.wstx.dtd.NameKey
All Implemented Interfaces:
java.lang.Comparable

public final class NameKey
extends java.lang.Object
implements java.lang.Comparable

Simple key Object to be used for storing/accessing of potentially namespace scoped element and attribute names.

One important note about usage is that two of the name components (prefix and local name) HAVE to have been interned some way, as all comparisons are done using identity comparison; whereas URI is NOT necessarily interned.

Note that the main reason this class is mutable -- unlike most key classes -- is that this allows reusing key objects for access, as long as the code using it knows ramifications of trying to modify a key that's used in a data structure.

Note, too, that the hash code is cached as this class is mostly used as a Map key, and hash code is used a lot.


Constructor Summary
NameKey(java.lang.String prefix, java.lang.String localName)
           
 
Method Summary
 int compareTo(java.lang.Object o)
           
 boolean equals(java.lang.Object o)
           
 java.lang.String getLocalName()
           
 java.lang.String getPrefix()
           
 int hashCode()
           
 boolean isaNsDeclaration()
           
 NameKey reset(java.lang.String prefix, java.lang.String localName)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

NameKey

public NameKey(java.lang.String prefix,
               java.lang.String localName)
Method Detail

reset

public NameKey reset(java.lang.String prefix,
                     java.lang.String localName)

getPrefix

public java.lang.String getPrefix()

getLocalName

public java.lang.String getLocalName()

isaNsDeclaration

public boolean isaNsDeclaration()
Returns:
True, if this attribute name would result in a namespace binding (ie. it's "xmlns" or starts with "xmlns:").

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

compareTo

public int compareTo(java.lang.Object o)
Specified by:
compareTo in interface java.lang.Comparable