Liking cljdoc? Tell your friends :D

hara.module.classloader


+base+


+class-cache+


+clojure-jar+


+rq+


+spec-jar+


add-url

(add-url path)
(add-url loader path)

adds a classpath to the loader

(add-url (fs/path "path/to/somewhere"))

adds a classpath to the loader

(add-url (fs/path "path/to/somewhere"))
raw docstring

all-jars

(all-jars)
(all-jars loader)

gets all jars on the classloader

(all-jars) => seq?

gets all jars on the classloader

(all-jars)
=> seq?
raw docstring

all-paths

(all-paths)
(all-paths loader)

gets all paths on the classloader

(all-paths) => seq?

gets all paths on the classloader

(all-paths)
=> seq?
raw docstring

all-urls

(all-urls)
(all-urls loader)

returns all urls contained by the loader

(all-urls)

returns all urls contained by the loader

(all-urls)
raw docstring

any-load-class

(any-load-class cls _ _)

loads a class, storing class into the global cache

(any-load-class test.Cat nil nil) => test.Cat

loads a class, storing class into the global cache

(any-load-class test.Cat nil nil)
=> test.Cat
raw docstring

classpath

(classpath)
(classpath loader)

returns the classpath for the loader, including parent loaders

(classpath)

returns the classpath for the loader, including parent loaders

(classpath)
raw docstring

delegation

(delegation cl)

returns a list of classloaders in order of top to bottom

(-> (Thread/currentThread) (.getContextClassLoader) (delegation)) => list?

returns a list of classloaders in order of top to bottom

(-> (Thread/currentThread)
    (.getContextClassLoader)
    (delegation))
=> list?
raw docstring

dynamic-classloader

(dynamic-classloader)
(dynamic-classloader urls)
(dynamic-classloader urls parent)

creates a dynamic classloader instance

(dynamic-classloader []) => clojure.lang.DynamicClassLoader

creates a dynamic classloader instance

(dynamic-classloader [])
=> clojure.lang.DynamicClassLoader
raw docstring

dynamic-load-bytes

(dynamic-load-bytes bytes loader {:keys [name source], :as opts})

loads a class from bytes

(dynamic-load-bytes (to-bytes "target/classes/test/Cat.class") (dynamic-classloader) {:name "test.Cat"}) => test.Cat

loads a class from bytes

(dynamic-load-bytes (to-bytes "target/classes/test/Cat.class")
                    (dynamic-classloader)
                    {:name "test.Cat"})
=> test.Cat
raw docstring

dynamic-load-coords

(dynamic-load-coords coordinates
                     loader
                     {:keys [entry-path], :as opts})

loads a class from a coordinate

(.getName (dynamic-load-coords '[org.yaml/snakeyaml "1.5"] (dynamic-classloader) {:name "org.yaml.snakeyaml.Dumper" :entry-path "org/yaml/snakeyaml/Dumper.class"})) => "org.yaml.snakeyaml.Dumper"

loads a class from a coordinate

(.getName (dynamic-load-coords '[org.yaml/snakeyaml "1.5"]
                               (dynamic-classloader)
                               {:name "org.yaml.snakeyaml.Dumper"
                                :entry-path "org/yaml/snakeyaml/Dumper.class"}))
=> "org.yaml.snakeyaml.Dumper"
raw docstring

dynamic-load-string

(dynamic-load-string path loader {:keys [entry-path], :as opts})

loads a class from a path string

(dynamic-load-string "<.m2>/org/yaml/snakeyaml/1.5/snakeyaml-1.5.jar" (dynamic-classloader) {:name "org.yaml.snakeyaml.Dumper" :entry-path "org/yaml/snakeyaml/Dumper.class"}) => org.yaml.snakeyaml.Dumper

loads a class from a path string

(dynamic-load-string "<.m2>/org/yaml/snakeyaml/1.5/snakeyaml-1.5.jar"
                     (dynamic-classloader)
                     {:name "org.yaml.snakeyaml.Dumper"
                      :entry-path "org/yaml/snakeyaml/Dumper.class"})
=> org.yaml.snakeyaml.Dumper
raw docstring

get-url

(get-url path)
(get-url loader path)

returns the required url

(get-url (fs/path "src")) ;;#object[java.net.URL 0x3d202d52 "file:/Users/chris/Development/hara/hara/src/"] => java.net.URL

returns the required url

(get-url (fs/path "src"))
;;#object[java.net.URL 0x3d202d52 "file:/Users/chris/Development/hara/hara/src/"]
=> java.net.URL
raw docstring

has-url?

(has-url? path)
(has-url? loader path)

checks whether the classloader has the following url

(has-url? (fs/path "src")) => true

checks whether the classloader has the following url

(has-url? (fs/path "src"))
=> true
raw docstring

load-class

(load-class x)
(load-class x opts)
(load-class x opts loader)

loads class from an external source

(.getName (load-class "target/classes/test/Cat.class" {:name "test.Cat"})) => "test.Cat"

loads class from an external source

(.getName (load-class "target/classes/test/Cat.class"
                      {:name "test.Cat"}))
=> "test.Cat"
raw docstring

remove-url

(remove-url path)
(remove-url loader path)

removes url from classloader

(do (add-url (fs/path "path/to/somewhere")) (has-url? (fs/path "path/to/somewhere"))) => true

(remove-url (fs/path "path/to/somewhere")) (has-url? (fs/path "path/to/somewhere")) => false

removes url from classloader

(do (add-url (fs/path "path/to/somewhere"))
    (has-url? (fs/path "path/to/somewhere")))
=> true

(remove-url (fs/path "path/to/somewhere"))
(has-url? (fs/path "path/to/somewhere"))
=> false
raw docstring

to-bytesmultimethod

opens .class file from an external source (to-bytes "target/classes/test/Dog.class") => check/bytes?

opens `.class` file from an external source
(to-bytes "target/classes/test/Dog.class")
=> check/bytes?
raw docstring

unload-class

(unload-class name)

unloads a class from the current namespace

(unload-class "test.Cat") ;; #object[java.lang.ref.SoftReference 0x10074132 ;; "java.lang.ref.SoftReference@10074132"]

unloads a class from the current namespace

(unload-class "test.Cat")
;; #object[java.lang.ref.SoftReference 0x10074132
;;         "java.lang.ref.SoftReference@10074132"]
raw docstring

url-classloader

(url-classloader urls)
(url-classloader urls parent)

returns a java.net.URLClassLoader from a list of strings

(->> (url-classloader ["/dev/null/"]) (.getURLs) (map str)) => ["file:/dev/null/"]

returns a `java.net.URLClassLoader` from a list of strings

(->> (url-classloader ["/dev/null/"])
     (.getURLs)
     (map str))
=> ["file:/dev/null/"]
raw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close