proxy-super

clojure.core

  • (proxy-super meth & args)
Use to call a superclass method in the body of a proxy method.
Note, expansion captures 'this

1 Example top

  • ;; 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
    
    
     
Log in to add / edit an example.

See Also top

Log in to add a see also.

Plus_12x12 Minus_12x12 Source clojure/core_proxy.clj:365 top

(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)))
Vars in clojure.core/proxy-super:
Used in 0 other vars

Comments top

No comments for proxy-super. Log in to add a comment.