Liking cljdoc? Tell your friends :D

hara.object.framework.write


*transform*clj


+meta-write-exactclj

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

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

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

+write-template+clj

(+write-template+ <method>)

constructs the write function template

constructs the write function template
raw docstring

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 default types] :as construct} methods cls)

creates the object from a constructor

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

creates the object from a constructor

(-> {:name "spike"}
    (write/from-constructor {:fn (fn [name] (Cat. name))
                             :params [:name]}
                            {:name {:type String}}))
;; #test.Cat{:name "spike", :species "cat"}
=> test.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-in {:class test.DogBuilder :empty fn?, :methods {:name {:type java.lang.String, :fn fn?}}})

access read-attributes with caching

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

meta-write-exactclj

(meta-write-exact cls)

access write attributes for the exact class

(write/meta-write-exact Object) => nil

access write attributes for the exact class

(write/meta-write-exact Object)
=> nil
raw docstring

meta-write-exact-rawclj

(meta-write-exact-raw cls)

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

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

meta-write-exact?clj

(meta-write-exact? cls)

checks if write attributes are avaliable

(write/meta-write-exact? Object) => false

checks if write attributes are avaliable

(write/meta-write-exact? Object)
=> false
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-constructorclj

(write-constructor cls params)

returns constructor element for a given class

(write/write-constructor Cat [:name]) ;;#elem[new :: (java.lang.String) -> test.Cat] => ifn?

returns constructor element for a given class

(write/write-constructor Cat [:name])
;;#elem[new :: (java.lang.String) -> test.Cat]
=> ifn?
raw docstring

write-exclj

(write-ex k)

writes a getter method that throws an an exception

((write/write-ex :hello) nil nil) => throws

writes a getter method that throws an an exception

((write/write-ex :hello) nil nil)
=> throws
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-setter-elementclj

(write-setter-element {:keys [element]} v)

also constructs array elements

(write/write-setter-element {:element Dog} [{:name "fido"}]) => (contains [test.Dog])

also constructs array elements

(write/write-setter-element {:element Dog} [{:name "fido"}])
=> (contains [test.Dog])
raw docstring

write-setter-valueclj

(write-setter-value methods obj k v)

sets the property given keyword and value

(-> (write/write-setter-value {:name {:type String :fn (fn [cat name] (.setName cat name))}} (Cat. "lido") :name "tim") (.getName)) => "tim"

sets the property given keyword and value

(-> (write/write-setter-value {:name {:type String
                                      :fn (fn [cat name] (.setName cat name))}}
                              (Cat. "lido")
                              :name
                              "tim")
    (.getName))
=> "tim"
raw docstring

write-settersclj

(write-setters cls)
(write-setters cls opts)
(write-setters
  cls
  {:keys [prefix template create]
   :or {prefix "set" template +write-template+ create create-write-method}}
  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