Created
August 9, 2010 03:03
-
-
Save brweber2/514863 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
(ns baz | |
(:import foo.com.Bar)) | |
(def p (proxy [Bar] [] (foo ([s] (do (println s) s)) ([s1 s2] (do (println s1 ":" s2) s2))))) | |
(println "p is " p) | |
(.foo p "hi!") | |
(.foo p "one" "two") | |
; works with: | |
; | |
; package foo.com; | |
; | |
; public interface Bar { | |
; public String foo(String a); | |
; | |
; public String foo(String a, String b); | |
; } | |
; Interestingly, seems to use only method name and arity | |
(ns baz | |
(:import foo.com.Bar) | |
(:import foo.com.Baz)) | |
(def p | |
(proxy [Bar Baz] [] (foo ([^Integer s] (do (println s) s)) ([^Integer s1 ^Integer s2] (do (println s1 ":" s2) s2)))) | |
) | |
(defn bleh [^Bar bar] (.foo bar "from bar")) | |
(defn bling [^Baz baz] (.foo baz 72)) | |
(println "p is " p) | |
(.foo p "hi!") | |
(.foo p "one" "two") | |
(bling p) | |
(bleh p) | |
; and the additional foo/com/Baz.java | |
; | |
; package foo.com; | |
; | |
; public interface Baz { | |
; public Integer foo(Integer a); | |
; | |
; public Integer foo(Integer a, Integer b); | |
; } | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
(ns baz
(:import foo.com.Bar)
(:import foo.com.Baz))
(def p
(proxy [Bar Baz] [](foo %28[^Integer s] %28do %28println s%29 s%29%29 %28[^Integer s1 ^Integer s2] %28do %28println s1 ":" s2) s2))))
)
(defn bleh [^Bar bar](.foo bar))
(defn bling [^Baz baz](.foo baz 72))
(println "p is " p)
(.foo p "hi!")
(.foo p "one" "two")
(bling p)
(bleh p)