Liking cljdoc? Tell your friends :D

hara.object.framework.write


*transform*clj


+meta-writeclj

(+meta-write ??)
?? invalid arglists:
()

cache for hara.object.framework.write/meta-write

cache for hara.object.framework.write/meta-write
raw docstring

+write-template+clj


create-write-methodclj

(create-write-method ele prefix template)

create a write method from the template

(-> ((-> (write/create-write-method (reflect/query-class Cat ["setName" :#]) "set" write/+write-template+) second :fn) (test.Cat. "spike") "fluffy") (.getName)) => "fluffy"

create a write method from the template

(-> ((-> (write/create-write-method (reflect/query-class Cat ["setName" :#])
                                    "set"
                                    write/+write-template+)
         second
         :fn) (test.Cat. "spike") "fluffy")
    (.getName))
=> "fluffy"
raw docstring

from-constructorclj

(from-constructor m {:keys [params] :as construct} methods)

creates the object from a constructor

(-> {:name "spike"} (write/from-constructor {:fn (fn [name] (Cat. name)) :params [:name]} {})) ;;=> #test.Cat{:name "spike", :species "cat"}

creates the object from a constructor

(-> {:name "spike"}
    (write/from-constructor {:fn (fn [name] (Cat. name))
                             :params [:name]}
                            {}))
;;=> #test.Cat{:name "spike", :species "cat"}
raw docstring

from-dataclj

(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"]
raw docstring

from-emptyclj

(from-empty m empty methods)

creates the object from an empty object constructor

(write/from-empty {:name "chris" :pet "dog"} (fn [] (java.util.Hashtable.)) {:name {:type String :fn (fn [obj v] (.put obj "hello" (keyword v)) obj)} :pet {:type String :fn (fn [obj v] (.put obj "pet" (keyword v)) obj)}}) => {"pet" :dog, "hello" :chris}

creates the object from an empty object constructor
 
 (write/from-empty {:name "chris" :pet "dog"}
                   (fn [] (java.util.Hashtable.))
                   {:name {:type String
                           :fn (fn [obj v]
                                 (.put obj "hello" (keyword v))
                                 obj)}
                    :pet  {:type String
                           :fn (fn [obj v]
                                 (.put obj "pet" (keyword v))
                                 obj)}})
=> {"pet" :dog, "hello" :chris}
raw docstring

from-mapclj

(from-map m cls)

creates the object from a map

(-> {:name "chris" :age 30 :pets [{:name "slurp" :species "dog"} {:name "happy" :species "cat"}]} (write/from-map test.Person) (read/to-data)) => (contains-in {:name "chris", :age 30, :pets [{:name "slurp"} {:name "happy"}]})

creates the object from a map

(-> {:name "chris" :age 30 :pets [{:name "slurp" :species "dog"}
                                  {:name "happy" :species "cat"}]}
    (write/from-map test.Person)
    (read/to-data))
=> (contains-in
    {:name "chris",
     :age 30,
     :pets [{:name "slurp"}
            {:name "happy"}]})
raw docstring

meta-writeclj

(meta-write cls)

access read-attributes with caching

(write/meta-write DogBuilder) => (contains {:class test.DogBuilder :empty fn?, :methods (contains {:name (contains {:type java.lang.String, :fn fn?})})})

access read-attributes with caching

(write/meta-write DogBuilder)
=> (contains {:class test.DogBuilder
              :empty fn?,
              :methods (contains
                        {:name
                         (contains {:type java.lang.String, :fn fn?})})})
raw docstring

meta-write-rawclj

(meta-write-raw cls)

helper function for hara.object.framework.write/meta-write

helper function for hara.object.framework.write/meta-write
raw docstring

write-all-fieldsclj

(write-all-fields cls)

all write fields of an object from reflection

(-> (write/write-all-fields {}) keys) => [:-hash :-hasheq :-meta :array]

all write fields of an object from reflection

(-> (write/write-all-fields {})
    keys)
=> [:-hash :-hasheq :-meta :array]
raw docstring

write-all-settersclj

(write-all-setters cls)
(write-all-setters cls opts)

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]
raw docstring

write-fieldsclj

(write-fields cls)
(write-fields cls query-fn)

write fields of an object from reflection

(-> (write/write-fields Dog) keys) => [:name :species]

write fields of an object from reflection

(-> (write/write-fields Dog)
    keys)
=> [:name :species]
raw docstring

write-settersclj

(write-setters cls)
(write-setters cls opts)
(write-setters cls
               {:keys [prefix template]
                :or {prefix "set" template +write-template+}}
               query-fn)

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]
raw docstring

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

× close