Class CodedName

  • All Implemented Interfaces:
    IdentityComparable, NodeName

    public class CodedName
    extends java.lang.Object
    implements NodeName
    An implementation of NodeName that encapsulates an integer fingerprint, a string prefix, and a reference to the NamePool from which the fingerprint was allocated.
    • Constructor Summary

      Constructors 
      Constructor Description
      CodedName​(int fingerprint, java.lang.String prefix, NamePool pool)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean equals​(java.lang.Object obj)
      Indicates whether some other object is "equal to" this one.
      java.lang.String getDisplayName()
      Get the display name, that is the lexical QName in the form [prefix:]local-part
      int getFingerprint()
      Get the fingerprint of this name if known.
      java.lang.String getLocalPart()
      Get the local part of the QName
      NamespaceBinding getNamespaceBinding()
      Get a NamespaceBinding whose (prefix, uri) pair are the prefix and URI of this node name
      NamespaceUri getNamespaceUri()
      Get the namespace URI of the QName.
      java.lang.String getPrefix()
      Get the prefix of the QName.
      StructuredQName getStructuredQName()
      Get the name in the form of a StructuredQName
      boolean hasFingerprint()
      Ask whether this node name representation has a known fingerprint
      int hashCode()
      Returns a hash code value for the object.
      boolean hasURI​(NamespaceUri ns)
      Test whether this name is in a given namespace
      int identityHashCode()
      Get a hashCode that offers the guarantee that if A.isIdentical(B), then A.identityHashCode() == B.identityHashCode()
      boolean isIdentical​(IdentityComparable other)
      Determine whether two IdentityComparable objects are identical.
      int obtainFingerprint​(NamePool namePool)
      Get the nameCode of this name, allocating a new code from the namepool if necessary
      java.lang.String toString()
      The toString() method returns the value of getDisplayName(), that is, the lexical QName
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • CodedName

        public CodedName​(int fingerprint,
                         java.lang.String prefix,
                         NamePool pool)
    • Method Detail

      • getPrefix

        public java.lang.String getPrefix()
        Get the prefix of the QName.
        Specified by:
        getPrefix in interface NodeName
        Returns:
        the prefix. Returns the empty string if the name is unprefixed.
      • getNamespaceUri

        public NamespaceUri getNamespaceUri()
        Get the namespace URI of the QName.
        Specified by:
        getNamespaceUri in interface NodeName
        Returns:
        the URI. Returns the empty string to represent the no-namespace
      • getLocalPart

        public java.lang.String getLocalPart()
        Get the local part of the QName
        Specified by:
        getLocalPart in interface NodeName
        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:
        getDisplayName in interface NodeName
        Returns:
        the lexical QName
      • getStructuredQName

        public StructuredQName getStructuredQName()
        Get the name in the form of a StructuredQName
        Specified by:
        getStructuredQName in interface NodeName
        Returns:
        the name in the form of a StructuredQName
      • hasURI

        public boolean hasURI​(NamespaceUri ns)
        Test whether this name is in a given namespace
        Specified by:
        hasURI in interface NodeName
        Parameters:
        ns - the namespace to be tested against
        Returns:
        true if the name is in the specified namespace
      • hasFingerprint

        public boolean hasFingerprint()
        Ask whether this node name representation has a known fingerprint
        Specified by:
        hasFingerprint in interface NodeName
        Returns:
        true if the method getFingerprint() 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:
        getFingerprint in interface NodeName
        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:
        obtainFingerprint in interface NodeName
        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:
        hashCode in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object obj)
        Indicates whether some other object is "equal to" this one.
        Overrides:
        equals in class java.lang.Object
      • isIdentical

        public boolean isIdentical​(IdentityComparable other)
        Description copied from interface: IdentityComparable
        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:
        isIdentical in interface IdentityComparable
        Parameters:
        other - the value to be compared with
        Returns:
        true if the two values are identical, 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:
        identityHashCode in interface IdentityComparable
        Returns:
        a hashCode suitable for use when testing for identity.
      • toString

        public java.lang.String toString()
        The toString() method returns the value of getDisplayName(), that is, the lexical QName
        Overrides:
        toString in class java.lang.Object
        Returns:
        the value as a lexical QName