Class DocumentKey

  • public class DocumentKey
    extends java.lang.Object
    This class encapsulates a string used as the value of the document-uri() property of a document, together with a normalized representation of the string used for equality comparisons. The idea is that on Windows systems, document URIs are compared using case-blind comparison, but the original case is retained for display purposes.

    The package name and version of the document reference are retained, because calls of doc() in different packages, using the same absolute URI, may return different documents, as a result of the treatment of whitespace and type annotations varying.

    • Field Summary

      Modifier and Type Field Description
      static boolean CASE_BLIND_FILES  
    • Constructor Summary

      Constructor Description
      DocumentKey​(java.lang.String uri)
      Create a DocumentURI object that wraps a given URI
      DocumentKey​(java.lang.String uri, java.lang.String packageName, PackageVersion version)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean equals​(java.lang.Object obj)  
      java.lang.String getAbsoluteURI()  
      int hashCode()  
      static java.lang.String normalizeURI​(java.lang.String uri)
      Normalize the representation of file: URIs to give better equality matching than straight string comparison.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

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


        public static final boolean CASE_BLIND_FILES
    • Constructor Detail

      • DocumentKey

        public DocumentKey​(java.lang.String uri)
        Create a DocumentURI object that wraps a given URI
        uri - the URI to be wrapped. Must not be null
        java.lang.NullPointerException - if uri is null
      • DocumentKey

        public DocumentKey​(java.lang.String uri,
                           java.lang.String packageName,
                           PackageVersion version)
    • Method Detail

      • getAbsoluteURI

        public java.lang.String getAbsoluteURI()
      • toString

        public java.lang.String toString()
        toString in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object obj)
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        hashCode in class java.lang.Object
      • normalizeURI

        public static java.lang.String normalizeURI​(java.lang.String uri)
        Normalize the representation of file: URIs to give better equality matching than straight string comparison. The main purpose is (a) to eliminate the distinction between "file:/" and "file:///", and (b) to normalize case in the case of Windows filenames: especially the distinction between "file:/C:" and "file:/c:".

        The result of this function should only be used when comparing two URIs to see if they correspond. The result is otherwise undefined; it might change between releases, and it might even not be a valid URI.

        uri - the URI to be normalized
        the normalized URI.