Liking cljdoc? Tell your friends :D

hara.reflect


apply-elementclj

(apply-element obj method args)

apply the class element to arguments

(->> (apply-element "123" "value" []) (map char)) => [ ]

apply the class element to arguments

(->> (apply-element "123" "value" [])
     (map char))
=> [  ]
raw docstring

class-hierarchyclj

(class-hierarchy obj)

Lists the class and interface hierarchy for the class

(class-hierarchy String) => [java.lang.String [java.lang.Object #{java.io.Serializable java.lang.Comparable java.lang.CharSequence}]]

Lists the class and interface hierarchy for the class

(class-hierarchy String)
=> [java.lang.String
    [java.lang.Object
     #{java.io.Serializable
       java.lang.Comparable
       java.lang.CharSequence}]]
raw docstring

class-infoclj

(class-info obj)

Lists class information

(class-info String) => (contains {:name "java.lang.String" :hash anything :modifiers #{:instance :class :public :final}})

Lists class information

(class-info String)
=> (contains {:name "java.lang.String"
              :hash anything
              :modifiers #{:instance :class :public :final}})
raw docstring

context-classclj

(context-class obj)

If x is a class, return x otherwise return the class of x

(context-class String) => String

(context-class "") => String

If x is a class, return x otherwise return the class of x

(context-class String)
=> String

(context-class "")
=> String
raw docstring

delegateclj

(delegate obj)

Allow transparent field access and manipulation to the underlying object.

(def a "hello") (def >a (delegate a))

(mapv char (>a :value)) => [\h \e \l \l \o]

(>a :value world-array) a => "world"

Allow transparent field access and manipulation to the underlying object.

(def a "hello")
(def >a  (delegate a))

(mapv char (>a :value)) => [\h \e \l \l \o]

(>a :value world-array)
a => "world"
raw docstring

extract-to-nsclj

(extract-to-ns class)
(extract-to-ns nssym class)
(extract-to-ns nssym class selectors)

extracts all class methods into its own namespace.

(map #(.sym %) (extract-to-ns 'test.string String [:private #"serial"])) => '[serialPersistentFields serialVersionUID]

extracts all class methods into its own namespace.

(map #(.sym %)
     (extract-to-ns 'test.string String [:private #"serial"]))
=> '[serialPersistentFields serialVersionUID]
raw docstring

extract-to-varclj

(extract-to-var varsym class method)
(extract-to-var varsym class method selectors)
(extract-to-var nssym varsym class method selectors)

extracts a class method into a namespace.

(extract-to-var 'hash-without clojure.lang.IPersistentMap 'without [])

(with-out-str (eval '(clojure.repl/doc hash-without))) => (str "-------------------------\n" "hara.reflect.core.extract-test/hash-without\n" "[[clojure.lang.IPersistentMap java.lang.Object]]\n" " \n" "member: clojure.lang.IPersistentMap/without\n" "type: clojure.lang.IPersistentMap\n" "modifiers: instance, method, public, abstract\n")

(eval '(hash-without {:a 1 :b 2} :a)) => {:b 2}

extracts a class method into a namespace.

(extract-to-var 'hash-without clojure.lang.IPersistentMap 'without [])

(with-out-str (eval '(clojure.repl/doc hash-without)))
=> (str "-------------------------\n"
        "hara.reflect.core.extract-test/hash-without\n"
        "[[clojure.lang.IPersistentMap java.lang.Object]]\n"
        "  \n"
        "member: clojure.lang.IPersistentMap/without\n"
        "type: clojure.lang.IPersistentMap\n"
        "modifiers: instance, method, public, abstract\n")

(eval '(hash-without {:a 1 :b 2} :a))
=> {:b 2}
raw docstring

query-classclj

(query-class obj selectors)

queries the java view of the class declaration

(query-class String [#"^c" :name]) ;;=> ["charAt" "checkBounds" "codePointAt" "codePointBefore" ;; "codePointCount" "compareTo" "compareToIgnoreCase" ;; "concat" "contains" "contentEquals" "copyValueOf"]

queries the java view of the class declaration

(query-class String  [#"^c" :name])
;;=> ["charAt" "checkBounds" "codePointAt" "codePointBefore"
;;    "codePointCount" "compareTo" "compareToIgnoreCase"
;;    "concat" "contains" "contentEquals" "copyValueOf"]
raw docstring

query-hierarchyclj

(query-hierarchy obj selectors)

lists what methods could be applied to a particular instance

(query-hierarchy String [:name #"^to"]) => ["toCharArray" "toLowerCase" "toString" "toUpperCase"]

lists what methods could be applied to a particular instance

(query-hierarchy String [:name #"^to"])
=> ["toCharArray" "toLowerCase" "toString" "toUpperCase"]
raw docstring

query-instanceclj

(query-instance obj selectors)

lists what methods could be applied to a particular instance

(query-instance "abc" [:name #"^to"]) => ["toCharArray" "toLowerCase" "toString" "toUpperCase"]

(query-instance String [:name #"^to"]) => (contains ["toString"])

lists what methods could be applied to a particular instance

(query-instance "abc" [:name #"^to"])
=> ["toCharArray" "toLowerCase" "toString" "toUpperCase"]

(query-instance String [:name #"^to"])
=> (contains ["toString"])
raw docstring

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

× close