I'm trying access to a static inner class method, but I can't find the right way.
我正在尝试访问静态内部类方法,但我找不到正确的方法。
I need to write this java code in Clojure:
我需要在Clojure中编写这个java代码:
SessionProperties sessionProperties = SessionProperties.Builder().mediaMode(MediaMode.ROUTED).build();
My code is:
我的代码是:
(:import [com.opentok OpenTok MediaMode SessionProperties SessionProperties$Builder]))
(def sessionProperties (.build (.mediaMode SessionProperties$Builder MediaMode/ROUTED))
And this is the error:
这是错误:
java.lang.IllegalArgumentException: No matching method found: mediaMode for class java.lang.Class
I'm using the opentok Java library and I don't understand how to access to mediaMode method.
我正在使用opentok Java库,我不明白如何访问mediaMode方法。
1 个解决方案
#1
Your Java code does not work. To fix the remedy, add the new
keyword between =
and SessionProperties.Builder()
. It should be:
您的Java代码不起作用。要修复补救措施,请在=和SessionProperties.Builder()之间添加new关键字。它应该是:
SessionProperties sessionProperties = new SessionProperties.Builder()
.mediaMode(MediaMode.ROUTED)
.build();
You can do this in Clojure as follows.
您可以在Clojure中执行以下操作。
user> (import '(com.opentok SessionProperties$Builder MediaMode))
com.opentok.MediaMode
user> (def session-properties (.. (SessionProperties$Builder.)
(mediaMode MediaMode/ROUTED)
build))
#'user/session-properties
user> session-properties
#<SessionProperties com.opentok.SessionProperties@54fc58ee>
#1
Your Java code does not work. To fix the remedy, add the new
keyword between =
and SessionProperties.Builder()
. It should be:
您的Java代码不起作用。要修复补救措施,请在=和SessionProperties.Builder()之间添加new关键字。它应该是:
SessionProperties sessionProperties = new SessionProperties.Builder()
.mediaMode(MediaMode.ROUTED)
.build();
You can do this in Clojure as follows.
您可以在Clojure中执行以下操作。
user> (import '(com.opentok SessionProperties$Builder MediaMode))
com.opentok.MediaMode
user> (def session-properties (.. (SessionProperties$Builder.)
(mediaMode MediaMode/ROUTED)
build))
#'user/session-properties
user> session-properties
#<SessionProperties com.opentok.SessionProperties@54fc58ee>