How to access static inner Java class via Clojure interop?

Jakub Arnold picture Jakub Arnold · Aug 21, 2011 · Viewed 8.3k times · Source

Basically what I need to do is this

FileChannel.MapMode.READ_ONLY

I tried doing the obvious

(.. FileChannel MapMode READ_ONLY)

but that ends up throwing an exception

java.lang.NoSuchFieldException: MapMode

even the / notation specified as for access static fields in the interop documentation produces the same exception

(. (FileChannel/MapMode) READ_ONLY)

Answer

Hamza Yerlikaya picture Hamza Yerlikaya · Aug 21, 2011

You access inner classes with $

java.nio.channels.FileChannel$MapMode/READ_ONLY

Mind that if you are importing FileChannel you should also import FileChannel$MapMode.