summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRich Hickey <richhickey@gmail.com>2008-06-17 12:29:06 +0000
committerRich Hickey <richhickey@gmail.com>2008-06-17 12:29:06 +0000
commita7050c6b8429dbd7e5b83a9c81ea35cc07588ac8 (patch)
tree3afacedddcfa16066e458c629c8075c5fb0ba056 /src
parent1cd6377ff7644f88680c7ec2107c0ff2b7997f22 (diff)
made proxy tolerant of ns-qualified method names
added proxy-super
Diffstat (limited to 'src')
-rw-r--r--src/proxy.clj15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/proxy.clj b/src/proxy.clj
index bc85b530..486b6f41 100644
--- a/src/proxy.clj
+++ b/src/proxy.clj
@@ -253,10 +253,23 @@
meths (map (fn [[params & body]]
(cons (apply vector 'this params) body))
meths)]
- (recur (assoc fmap (list `quote sym) (cons `fn meths)) (rest fs)))
+ (recur (assoc fmap (list `quote (symbol (name sym))) (cons `fn meths)) (rest fs)))
fmap)))
p#))
+(defn proxy-call-with-super [call this meth]
+ (let [m (proxy-mappings this)]
+ (update-proxy this (assoc m meth nil))
+ (let [ret (call)]
+ (update-proxy this m)
+ ret)))
+
+(defmacro proxy-super
+ "Use to call a superclass method in the body of a proxy method.
+ Note, expansion captures 'this"
+ [meth & args]
+ `(proxy-call-with-super (fn [] (. ~'this ~meth ~@args)) ~'this '~(symbol (name meth))))
+
(defn bean
"Takes a Java object and returns a read-only implementation of the
map abstraction based upon its JavaBean properties."