Created
February 23, 2013 14:46
-
-
Save zerg000000/5020022 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; copy from https://github.com/daveray/seesaw/blob/develop/src/seesaw/options.clj | |
(defrecord Option [name setter getter examples]) | |
(defmacro bean-option | |
[name-arg target-type & [set-conv get-conv examples]] | |
(let [[option-name bean-property-name] (split-bean-option-name name-arg) | |
target (gensym "target")] | |
`(Option. ~option-name | |
(fn [~(with-meta target {:tag target-type}) value#] | |
(. ~target ~(setter-name bean-property-name) (~(or set-conv `identity) value#))) | |
(fn [~(with-meta target {:tag target-type})] | |
(~(or get-conv `identity) (. ~target ~(getter-name bean-property-name)))) | |
~examples))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment