Clojure vars and Java static methods

前端 未结 3 2070
再見小時候
再見小時候 2020-12-06 03:05

I\'m a few days into learning Clojure and are having some teething problems, so I\'m asking for advice.

I\'m trying to store a Java class in a Clojure var and call i

3条回答
  •  攒了一身酷
    2020-12-06 03:43

    You are successfully storing the class in jmod, but isPrivate is a static method of java.lang.reflect.Modifier, not of java.lang.Class.

    You could do this with reflection:

    (. (. jmod getMethod "isPrivate" (into-array [Integer/TYPE])) 
      invoke nil (into-array [1]))
    

提交回复
热议问题