Liking cljdoc? Tell your friends :D
Clojure only.

clj-foundation.oo

Simplify Java object interop

Simplify Java object interop
raw docstring

bean-propscljmacro

(bean-props object & props)

Like (bean... but allows specifying the properties to convert and allows chained nested properties. Property names are translated to idiomatic hyphenated Clojure keywords in the resulting Map.

e.g.: Given the following beans: (def jd-address (Address. "42 Computer Blvd." "" "Acme" "AZ" "99999")) (def john-doe (Person. "John" "Doe" jd-address))

then:

(bean-props john-doe :firstName :lastName :address) ==> {:first-name "John" :last-name "Doe" :address <some address object>}

One step farther:

(bean-props john-doe :firstName :lastName :address.street :address.street2 :address.city :address.state :address.postalCode) ==> {:first-name "John" :last-name "Doe" :address.street "42 Computer Blvd." :address.street2 "" :address.city "Acme" :address.state "AZ" :address.postal-code "99999"}

Like (bean... but allows specifying the properties to convert and allows chained nested properties.
Property names are translated to idiomatic hyphenated Clojure keywords in the resulting Map.

e.g.: Given the following beans:
(def jd-address (Address. "42 Computer Blvd." "" "Acme" "AZ" "99999"))
(def john-doe (Person. "John" "Doe" jd-address))

then:

(bean-props john-doe :firstName :lastName :address)
==>
{:first-name          "John"
 :last-name           "Doe"
 :address             <some address object>}

One step farther:

(bean-props john-doe :firstName :lastName :address.street :address.street2 :address.city :address.state :address.postalCode)
==>
{:first-name          "John"
 :last-name           "Doe"
 :address.street      "42 Computer Blvd."
 :address.street2     ""
 :address.city        "Acme"
 :address.state       "AZ"
 :address.postal-code "99999"}
sourceraw docstring

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

× close