Liking cljdoc? Tell your friends :D

hara.module.classloader


+base+clj


+class-cache+clj


+clojure-jar+clj


+rq+clj


+spec-jar+clj


add-urlclj

(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-jarsclj

(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-pathsclj

(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-urlsclj

(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-classclj

(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

classpathclj

(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

delegationclj

(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-classloaderclj

(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-bytesclj

(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-coordsclj

(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-stringclj

(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-urlclj

(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?clj

(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-classclj

(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-urlclj

(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-bytescljmultimethod

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-classclj

(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-classloaderclj

(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