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:
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.
Your Java code does not work. To fix the remedy, add the new
keyword between =
and SessionProperties.Builder()
. It should be:
SessionProperties sessionProperties = new SessionProperties.Builder()
.mediaMode(MediaMode.ROUTED)
.build();
You can do this in Clojure as follows.
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>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.