Class JavadocSite


  • class JavadocSite
    extends java.lang.Object
    Allows to create links to a site generated by javadoc (incl. deep-linking). The site may be either accessible (online) or non-accessible (offline) when using this class.
    • Constructor Detail

      • JavadocSite

        JavadocSite​(java.net.URI url,
                    org.apache.maven.settings.Settings settings)
             throws java.io.IOException
        Constructor for online sites having an accessible package-list or element-list.
        Parameters:
        url -
        settings -
        Throws:
        java.io.IOException
    • Method Detail

      • getPackageListWithModules

        static java.util.Map<java.lang.String,​java.lang.String> getPackageListWithModules​(java.net.URI url,
                                                                                                org.apache.maven.settings.Settings settings)
                                                                                         throws java.io.IOException
        Throws:
        java.io.IOException
      • findLineContaining

        static boolean findLineContaining​(java.net.URI url,
                                          org.apache.maven.settings.Settings settings,
                                          java.util.regex.Pattern pattern)
                                   throws java.io.IOException
        Throws:
        java.io.IOException
      • getBaseUri

        public java.net.URI getBaseUri()
      • hasEntryFor

        public boolean hasEntryFor​(java.util.Optional<java.lang.String> moduleName,
                                   java.util.Optional<java.lang.String> packageName)
      • createLink

        public java.net.URI createLink​(java.lang.String packageName,
                                       java.lang.String className)
        Generates a link to a javadoc html page below the javadoc site represented by this object. The link is not validated (i.e. might point to a non-existing page)
        Returns:
        the (deep-)link towards a javadoc page
        Throws:
        java.lang.IllegalArgumentException - if no link can be created
      • getPackageAndClassName

        static java.util.Map.Entry<java.lang.String,​java.lang.String> getPackageAndClassName​(java.lang.String binaryName)
        Splits up a given binary class name into package name and simple class name part.
        Parameters:
        binaryName - a binary name according to JLS 13.1
        Returns:
        a key value pair where the key is the package name and the value the class name
        Throws:
        java.lang.IllegalArgumentException - if no link can be created
      • createLink

        public java.net.URI createLink​(FullyQualifiedJavadocReference javadocReference)
                                throws java.lang.IllegalArgumentException
        Generates a link to a javadoc html page below the javadoc site represented by this object. The link is not validated (i.e. might point to a non-existing page)
        Parameters:
        javadocReference - a code reference from a javadoc tag
        Returns:
        the (deep-)link towards a javadoc page
        Throws:
        java.lang.IllegalArgumentException - if no link can be created
      • createLink

        static java.net.URI createLink​(FullyQualifiedJavadocReference javadocReference,
                                       java.net.URI baseUri,
                                       java.util.function.BiFunction<java.net.URI,​FullyQualifiedJavadocReference,​java.net.URI> fragmentAppender,
                                       java.util.Optional<java.lang.String> pathPrefix)
                                throws java.lang.IllegalArgumentException
        Throws:
        java.lang.IllegalArgumentException
      • createLink

        static java.net.URI createLink​(java.net.URI baseUri,
                                       java.util.Optional<java.lang.String> moduleName,
                                       java.util.Optional<java.lang.String> packageName,
                                       java.util.Optional<java.lang.String> className)
                                throws java.net.URISyntaxException
        Throws:
        java.net.URISyntaxException
      • getFragmentForMember

        static java.lang.String getFragmentForMember​(JavadocLinkGenerator.JavadocToolVersionRange version,
                                                     java.lang.String member,
                                                     boolean isConstructor)
        canonical format given by member is using parentheses and comma.
        Parameters:
        version -
        member -
        isConstructor -
        Returns:
        the anchor
      • findAnchor

        boolean findAnchor​(java.net.URI uri,
                           java.lang.String anchorNameOrId)
                    throws java.net.MalformedURLException,
                           java.io.IOException
        Throws:
        java.net.MalformedURLException
        java.io.IOException
      • getAnchorPattern

        static java.util.regex.Pattern getAnchorPattern​(java.lang.String anchorNameOrId)
      • createHttpClient

        private static org.apache.http.impl.client.CloseableHttpClient createHttpClient​(org.apache.maven.settings.Settings settings,
                                                                                        java.net.URL url)
        Creates a new HttpClient instance.
        Parameters:
        settings - The settings to use for setting up the client or null.
        url - The URL to use for setting up the client or null.
        Returns:
        A new HttpClient instance.
        Since:
        2.8
        See Also:
        DEFAULT_TIMEOUT
      • getReader

        static java.io.BufferedReader getReader​(java.net.URL url,
                                                org.apache.maven.settings.Settings settings)
                                         throws java.io.IOException
        Throws:
        java.io.IOException
      • isNotEmpty

        public static boolean isNotEmpty​(java.util.Collection<?> collection)
        Convenience method to determine that a collection is not empty or null.
        Parameters:
        collection - the collection to verify
        Returns:
        true if not null and not empty, otherwise false