Access to a Java static inner class with Clojure

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()

You can do this in Clojure as follows.

user> (import '(com.opentok SessionProperties$Builder MediaMode))

user> (def session-properties (.. (SessionProperties$Builder.)
                                  (mediaMode MediaMode/ROUTED)

user> session-properties
#<SessionProperties com.opentok.SessionProperties@54fc58ee>

Need Your Help

ADO.Net best practice - Single vs multiple Connections when making asynchronous db calls

.net sql asynchronous

I am using ADO.Net for connecting to some Sql Server and Oracle databases, and I want to run some of my queries concurrently.

why does my code hang?

java multithreading java-me synchronized

I'm very curious about this thing. I have some code, in a synchronized block,