(+meta-write-exact ??)
()
cache for hara.object.framework.write/meta-write-exact
cache for hara.object.framework.write/meta-write-exact
(+write-template+ <cls> <method> <return>)
constructs the write function template
constructs the write function template
(create-write-method-form ele prefix template select)
create a write method from the template
(-> ^test.Cat ((eval (-> (write/create-write-method-form (reflect/query-class Cat ["setName" :#]) "set" write/+write-template+ {}) second :fn)) (test.Cat. "spike") "fluffy") (.getName)) => "fluffy"
create a write method from the template (-> ^test.Cat ((eval (-> (write/create-write-method-form (reflect/query-class Cat ["setName" :#]) "set" write/+write-template+ {}) second :fn)) (test.Cat. "spike") "fluffy") (.getName)) => "fluffy"
(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)) ;; #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)) ;; #test.Cat{:name "spike", :species "cat"} => test.Cat
(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"]
(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 [^java.util.Hashtable obj v] (.put obj "hello" (keyword v)) obj)} :pet {:type String :fn (fn [^java.util.Hashtable 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 [^java.util.Hashtable obj v] (.put obj "hello" (keyword v)) obj)} :pet {:type String :fn (fn [^java.util.Hashtable obj v] (.put obj "pet" (keyword v)) obj)}}) => {"pet" :dog, "hello" :chris}
(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"}]})
(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?}}})
(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
(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
(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
(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]
(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]
(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?
(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
(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]
(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])
(write-setter-value methods obj k v)
sets the property given keyword and value
(-> ^test.Cat (write/write-setter-value {:name {:type String :fn (fn [^test.Cat cat name] (.setName cat name))}} (Cat. "lido") :name "tim") (.getName)) => "tim"
sets the property given keyword and value (-> ^test.Cat (write/write-setter-value {:name {:type String :fn (fn [^test.Cat cat name] (.setName cat name))}} (Cat. "lido") :name "tim") (.getName)) => "tim"
(write-setters cls)
(write-setters cls opts)
(write-setters cls opts 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]
(write-setters-form cls)
(write-setters-form cls opts)
(write-setters-form
cls
{:keys [prefix template create select]
:or {prefix "set" template +write-template+ create create-write-method-form}}
query-fn)
constructs forms for a given object
(write/write-setters-form DogBuilder) => '{:name {:type java.lang.String, :fn (clojure.core/fn setName [obj val] (clojure.core/or (. obj (setName val)) obj))}}
constructs forms for a given object (write/write-setters-form DogBuilder) => '{:name {:type java.lang.String, :fn (clojure.core/fn setName [obj val] (clojure.core/or (. obj (setName val)) obj))}}
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close