(definterface name & sigs)
Creates a new Java interface with the given name and method sigs.
The method return types and parameter types may be specified with type hints,
defaulting to Object if omitted.
(definterface MyInterface
(^int method1 [x])
(^Bar method2 [^Baz b ^Quux q]))
Source
(defmacro definterface
"Creates a new Java interface with the given name and method sigs.
The method return types and parameter types may be specified with type hints,
defaulting to Object if omitted.
(definterface MyInterface
(^int method1 [x])
(^Bar method2 [^Baz b ^Quux q]))"
{:added "1.2"} ;; Present since 1.2, but made public in 1.5.
[name & sigs]
(let [tag (fn [x] (or (:tag (meta x)) Object))
psig (fn [[name [& args]]]
(vector name (vec (map tag args)) (tag name) (map meta args)))
cname (with-meta (symbol (str (namespace-munge *ns*) "." name)) (meta name))]
`(let []
(gen-interface :name ~cname :methods ~(vec (map psig sigs)))
(import ~cname))))