Search code examples
clojure

How do I specify which java function to use in clojure?


In Clojure you can only write

(.getName guild)

for JDA. I want to get the name of this guild, but it's trying to cast it to Class from Java, instead. I cannot exactly type something like this either to my understanding:

(Guild/getName guild)
; nor this:
(Guild.getName guild)
; and at least not this:
(guild.getName)

Do anyone know what to do?


Solution

  • I figured it out by simply using type hinting:

    (let [^Guild guild (.getGuildById jda "idHere")])