gpt4 book ai didi

clojure - 如何在 Clojure 中调用公共(public)类的非公共(public)方法?

转载 作者:行者123 更新时间:2023-12-01 05:45:43 25 4
gpt4 key购买 nike

我正在使用 Clojure 调用 twitter4j 库,如下所示:

(def twitter (. (TwitterFactory.) getInstance))

当我将其称为脚本时,这很好用。但是当我使用 gen-class 时,我得到:
java.lang.IllegalArgumentException: Can't call public method of non-public class: public java.lang.Object twitter4j.TwitterFactoryBase.getInstance()

有解决方法吗?

最佳答案

我自己没有这方面的经验,但是 Meikel Brandmeyer 曾经在 gen-class 上写过一篇不错的文章,也许这会对你有所帮助:

http://kotka.de/blog/2010/02/gen-class_how_it_works_and_how_to_use_it.html

关于clojure - 如何在 Clojure 中调用公共(public)类的非公共(public)方法?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2500790/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com