Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
(defn unbean [m]
"Tries to recreate a simple JavaBean object from map m"
(let [obj (.newInstance (:class m))]
(doseq [[k v] (dissoc m :class)]
(try
(clojure.lang.Reflector/setInstanceField obj (name k) v)
(catch Exception _ nil)))
obj))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.