Scaffold by Christophe Grand
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
(defn scaffold | |
"Print the ancestor method signatures of a given interface." | |
[iface] | |
(doseq [[iface methods] (->> iface | |
.getMethods | |
(map #(vector (.getName (.getDeclaringClass %)) | |
(symbol (.getName %)) | |
(count (.getParameterTypes %)))) | |
(group-by first))] | |
(println (str " " iface)) | |
(doseq [[_ name argcount] methods] | |
(println | |
(str " " | |
(list name (into ['this] (take argcount (repeatedly gensym))))))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment