Use to call a superclass method in the body of a proxy method.
Note, expansion captures 'this
;; Create a proxy for java.util.ArrayList that overrides the add()
;; method and calls the super class implementation using proxy-super.
(def lst (proxy [java.util.ArrayList] []
(add [x]
(println "Adding some stuff:" x)
(proxy-super add x))))
user=> (.add lst 1)
Adding some stuff: 1
true
user=> (.add lst 2)
Adding some stuff: 2
true
user=> (.add lst [:this :is :some :other :stuff])
Adding some stuff: [:this :is :some :other :stuff]
true
user=> (.size lst)
3
(defmacro proxy-super
"Use to call a superclass method in the body of a proxy method.
Note, expansion captures 'this"
{:added "1.0"}
[meth & args]
`(proxy-call-with-super (fn [] (. ~'this ~meth ~@args)) ~'this ~(name meth)))
Comments top
No comments for proxy-super. Log in to add a comment.