Package com.ctc.wstx.util
Class PrefixedName
- java.lang.Object
-
- com.ctc.wstx.util.PrefixedName
-
- All Implemented Interfaces:
java.lang.Comparable<PrefixedName>
public final class PrefixedName extends java.lang.Object implements java.lang.Comparable<PrefixedName>
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.
-
-
Field Summary
Fields Modifier and Type Field Description (package private) int
mHash
private java.lang.String
mLocalName
private java.lang.String
mPrefix
-
Constructor Summary
Constructors Constructor Description PrefixedName(java.lang.String prefix, java.lang.String localName)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compareTo(PrefixedName other)
boolean
equals(java.lang.Object o)
java.lang.String
getLocalName()
java.lang.String
getPrefix()
int
hashCode()
boolean
isaNsDeclaration()
boolean
isXmlReservedAttr(boolean nsAware, java.lang.String localName)
Method used to check for xml reserved attribute names, like "xml:space" and "xml:id".PrefixedName
reset(java.lang.String prefix, java.lang.String localName)
java.lang.String
toString()
static PrefixedName
valueOf(javax.xml.namespace.QName n)
-
-
-
Method Detail
-
reset
public PrefixedName reset(java.lang.String prefix, java.lang.String localName)
-
valueOf
public static PrefixedName valueOf(javax.xml.namespace.QName n)
-
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:").
-
isXmlReservedAttr
public boolean isXmlReservedAttr(boolean nsAware, java.lang.String localName)
Method used to check for xml reserved attribute names, like "xml:space" and "xml:id".Note: it is assumed that the passed-in localName is also interned.
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
compareTo
public int compareTo(PrefixedName other)
- Specified by:
compareTo
in interfacejava.lang.Comparable<PrefixedName>
-
-