Package net.sf.saxon.om
Class NameOfNode
- java.lang.Object
-
- net.sf.saxon.om.NameOfNode
-
- All Implemented Interfaces:
IdentityComparable,NodeName
public class NameOfNode extends java.lang.Object implements NodeName
An implementation of NodeName that gets the name of an existing NodeInfo object. Useful when nodes are copied. However, it's not safe to use when the node is mutable.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object obj)Indicates whether some other object is "equal to" this one.java.lang.StringgetDisplayName()Get the display name, that is the lexical QName in the form [prefix:]local-partintgetFingerprint()Get the fingerprint of this name if known.java.lang.StringgetLocalPart()Get the local part of the QNameNamespaceBindinggetNamespaceBinding()Get aNamespaceBindingwhose (prefix, uri) pair are the prefix and URI of this node namejava.lang.StringgetPrefix()Get the prefix of the QName.StructuredQNamegetStructuredQName()Get the name in the form of a StructuredQNamejava.lang.StringgetURI()Get the namespace URI of the QName.booleanhasFingerprint()Ask whether this node name representation has a known namecode and fingerprintinthashCode()Returns a hash code value for the object.booleanhasURI(java.lang.String ns)Test whether this name is in a given namespaceintidentityHashCode()Get a hashCode that offers the guarantee that if A.isIdentical(B), then A.identityHashCode() == B.identityHashCode()booleanisIdentical(IdentityComparable other)Determine whether two IdentityComparable objects are identical.static NodeNamemakeName(NodeInfo node)Make a NodeName object based on the name of a supplied node.intobtainFingerprint(NamePool namePool)Get the nameCode of this name, allocating a new code from the namepool if necessary
-
-
-
Method Detail
-
makeName
public static NodeName makeName(NodeInfo node)
Make a NodeName object based on the name of a supplied node.- Parameters:
node- the supplied node- Returns:
- a NameOfNode object unless the node is mutable, in which case an immutable name is returned.
-
getPrefix
public java.lang.String getPrefix()
Get the prefix of the QName.
-
getURI
public java.lang.String getURI()
Get the namespace URI of the QName.
-
getLocalPart
public java.lang.String getLocalPart()
Get the local part of the QName- Specified by:
getLocalPartin interfaceNodeName- Returns:
- the local part of the QName
-
getDisplayName
public java.lang.String getDisplayName()
Get the display name, that is the lexical QName in the form [prefix:]local-part- Specified by:
getDisplayNamein interfaceNodeName- Returns:
- the lexical QName
-
getStructuredQName
public StructuredQName getStructuredQName()
Get the name in the form of a StructuredQName- Specified by:
getStructuredQNamein interfaceNodeName- Returns:
- the name in the form of a StructuredQName
-
hasURI
public boolean hasURI(java.lang.String ns)
Test whether this name is in a given namespace
-
getNamespaceBinding
public NamespaceBinding getNamespaceBinding()
Get aNamespaceBindingwhose (prefix, uri) pair are the prefix and URI of this node name- Specified by:
getNamespaceBindingin interfaceNodeName- Returns:
- the corresponding NamespaceBinding
-
hasFingerprint
public boolean hasFingerprint()
Ask whether this node name representation has a known namecode and fingerprint- Specified by:
hasFingerprintin interfaceNodeName- Returns:
- true if the methods getFingerprint() and getNameCode() will return a result other than -1
-
getFingerprint
public int getFingerprint()
Get the fingerprint of this name if known. This method should not to any work to allocate a fingerprint if none is already available- Specified by:
getFingerprintin interfaceNodeName- Returns:
- the fingerprint if known; otherwise -1
-
obtainFingerprint
public int obtainFingerprint(NamePool namePool)
Get the nameCode of this name, allocating a new code from the namepool if necessary- Specified by:
obtainFingerprintin interfaceNodeName- Parameters:
namePool- the NamePool used to allocate the name- Returns:
- a nameCode for this name, newly allocated if necessary
-
hashCode
public int hashCode()
Returns a hash code value for the object.- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
Indicates whether some other object is "equal to" this one.- Overrides:
equalsin classjava.lang.Object
-
isIdentical
public boolean isIdentical(IdentityComparable other)
Determine whether two IdentityComparable objects are identical. This is a stronger test than equality (even schema-equality); for example two dateTime values are not identical unless they are in the same timezone.- Specified by:
isIdenticalin interfaceIdentityComparable- Parameters:
other-- Returns:
- true if the two values are indentical, false otherwise
-
identityHashCode
public int identityHashCode()
Get a hashCode that offers the guarantee that if A.isIdentical(B), then A.identityHashCode() == B.identityHashCode()- Specified by:
identityHashCodein interfaceIdentityComparable- Returns:
- a hashCode suitable for use when testing for identity.
-
-