(from-data arg cls)
creates the object from data (-> (write/from-data ["hello"] (Class/forName "[Ljava.lang.String;")) seq) => ["hello"]
creates the object from data (-> (write/from-data ["hello"] (Class/forName "[Ljava.lang.String;")) seq) => ["hello"]
(get obj k)
accessor with either keyword or array lookup
(access/get (test.Cat. "spike") :name) => "spike"
accessor with either keyword or array lookup (access/get (test.Cat. "spike") :name) => "spike"
(map-like & {:as classes})
creates an accessibility layer for map-like objects
(map-like org.eclipse.jgit.revwalk.RevCommit {:tag "commit" :include [:commit-time :name :author-ident :full-message]})
(map-like org.eclipse.jgit.lib.PersonIdent {:tag "person" :exclude [:time-zone]})
(map-like org.eclipse.jgit.api.Status {:tag "status" :display (fn [m] (reduce-kv (fn [out k v] (if (and (or (instance? java.util.Collection v) (instance? java.util.Map v)) (empty? v)) out (assoc out k v))) {} m))})
creates an accessibility layer for map-like objects (map-like org.eclipse.jgit.revwalk.RevCommit {:tag "commit" :include [:commit-time :name :author-ident :full-message]}) (map-like org.eclipse.jgit.lib.PersonIdent {:tag "person" :exclude [:time-zone]}) (map-like org.eclipse.jgit.api.Status {:tag "status" :display (fn [m] (reduce-kv (fn [out k v] (if (and (or (instance? java.util.Collection v) (instance? java.util.Map v)) (empty? v)) out (assoc out k v))) {} m))})
(meta-read cls)
accesses the read-attributes of an object
(read/meta-read Pet) => (contains-in {:class test.Pet :methods {:name fn? :species fn?}})
accesses the read-attributes of an object (read/meta-read Pet) => (contains-in {:class test.Pet :methods {:name fn? :species fn?}})
(meta-write cls)
accesses the write-attributes of an object
(write/meta-write DogBuilder) => (contains {:class test.DogBuilder :empty fn?, :methods (contains {:name (contains {:type java.lang.String, :fn fn?})})})
accesses the write-attributes of an object (write/meta-write DogBuilder) => (contains {:class test.DogBuilder :empty fn?, :methods (contains {:name (contains {:type java.lang.String, :fn fn?})})})
(read-all-getters cls)
(read-all-getters cls {:keys [prefix template extra]})
returns fields of an object and base classes (-> (read/read-all-getters Dog) keys) => [:class :name :species]
returns fields of an object and base classes (-> (read/read-all-getters Dog) keys) => [:class :name :species]
(read-getters cls)
(read-getters cls {:keys [prefix template extra]})
returns fields of an object through getter methods (-> (read/read-getters Dog) keys) => [:name :species]
returns fields of an object through getter methods (-> (read/read-getters Dog) keys) => [:name :species]
(read-reflect-fields cls)
fields of an object from reflection (-> (read/read-reflect-fields Dog) keys) => [:name :species]
fields of an object from reflection (-> (read/read-reflect-fields Dog) keys) => [:name :species]
(set obj m)
(set obj k v)
sets the fields of an object with a map
(-> (doto (test.Cat. "spike") (access/set {:name "fluffy"})) (access/get :name)) => "fluffy"
sets the fields of an object with a map (-> (doto (test.Cat. "spike") (access/set {:name "fluffy"})) (access/get :name)) => "fluffy"
(string-like & {:as classes})
creates an accessibility layer for string-like objects
(string-like java.io.File {:tag "path" :read (fn [f] (.getPath f)) :write (fn [^String path] (java.io.File. path))})
(to-data (java.io.File. "/home")) => "/home"
(from-data "/home" java.io.File) => java.io.File
;; Enums are automatically string-like
(to-data java.lang.Thread$State/NEW) => "NEW"
creates an accessibility layer for string-like objects (string-like java.io.File {:tag "path" :read (fn [f] (.getPath f)) :write (fn [^String path] (java.io.File. path))}) (to-data (java.io.File. "/home")) => "/home" (from-data "/home" java.io.File) => java.io.File ;; Enums are automatically string-like (to-data java.lang.Thread$State/NEW) => "NEW"
(to-data obj)
creates the object from a string or map
(read/to-data "hello") => "hello"
(read/to-data (write/from-map {:name "hello" :species "dog"} Pet)) => (contains {:name "hello"})
creates the object from a string or map (read/to-data "hello") => "hello" (read/to-data (write/from-map {:name "hello" :species "dog"} Pet)) => (contains {:name "hello"})
(to-map obj)
creates a map from an object
(read/to-map (Cat. "spike")) => {:name "spike"}
creates a map from an object (read/to-map (Cat. "spike")) => {:name "spike"}
(vector-like & {:as classes})
creates an accessibility layer for vector-like objects
(vector-like org.eclipse.jgit.revwalk.RevWalk {:tag "commits" :read (fn [^org.eclipse.jgit.revwalk.RevWalk walk] (->> walk (.iterator) to-data))})
creates an accessibility layer for vector-like objects (vector-like org.eclipse.jgit.revwalk.RevWalk {:tag "commits" :read (fn [^org.eclipse.jgit.revwalk.RevWalk walk] (->> walk (.iterator) to-data))})
(write-all-setters cls)
(write-all-setters cls
{:keys [prefix template]
:or {prefix "set" template default-write-template}})
write all setters of an object and base classes (write/write-all-setters Dog) => {}
(keys (write/write-all-setters DogBuilder)) => [:name]
write all setters of an object and base classes (write/write-all-setters Dog) => {} (keys (write/write-all-setters DogBuilder)) => [:name]
(write-reflect-fields cls)
write fields of an object from reflection (-> (write/write-reflect-fields Dog) keys) => [:name :species]
write fields of an object from reflection (-> (write/write-reflect-fields Dog) keys) => [:name :species]
(write-setters cls)
(write-setters cls
{:keys [prefix template]
:or {prefix "set" template default-write-template}})
write fields of an object through setter methods (write/write-setters Dog) => {}
(keys (write/write-setters DogBuilder)) => [:name]
write fields of an object through setter methods (write/write-setters Dog) => {} (keys (write/write-setters DogBuilder)) => [:name]
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close