1.2.0 permalink Arrow_down_16x16

find-javadoc-url

clojure.contrib.repl-utils

  • (find-javadoc-url classname)
Searches for a URL for the given class name. Tries
*local-javadocs* first, then *remote-javadocs*. Returns a string.

0 Examples top

Log in to add / edit an example.

See Also top

Log in to add a see also.

Plus_12x12 Minus_12x12 Source clojure/contrib/repl_utils/javadoc.clj:54 top

(defn find-javadoc-url
  "Searches for a URL for the given class name.  Tries
  *local-javadocs* first, then *remote-javadocs*.  Returns a string."
  {:tag String}
  [^String classname]
  (let [file-path (.replace classname \. File/separatorChar)
        url-path (.replace classname \. \/)]
    (if-let [file ^File (first
                           (filter #(.exists ^File %)
                             (map #(File. (str %) (str file-path ".html"))
                               @*local-javadocs*)))]
      (-> file .toURI str)
      ;; If no local file, try remote URLs:
      (or (some (fn [[prefix url]]
                  (when (.startsWith classname prefix)
                    (str url url-path ".html")))
            @*remote-javadocs*)
        ;; if *feeling-lucky* try a web search
        (when *feeling-lucky* (str *feeling-lucky-url* url-path ".html"))))))
Vars in clojure.contrib.repl-utils/find-javadoc-url: *feeling-lucky* *feeling-lucky-url* *remote-javadocs* -> defn fn if-let let or some str when deref
Used in 0 other vars

Comments top

No comments for find-javadoc-url. Log in to add a comment.