如何通过Clojure interop访问静态内部Java类? [英] How to access static inner Java class via Clojure interop?

查看:81
本文介绍了如何通过Clojure interop访问静态内部Java类?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

基本上我需要做的是这

  FileChannel.MapMode.READ_ONLY 



我试着做了显而易见的

  。FileChannel MapMode READ_ONLY)

但最终会抛出异常

  java.lang.NoSuchFieldException:MapMode 

即使在 interop文档中为访问静态字段指定的 / 符号也会生成相同的异常

 (FileChannel / MapMode)READ_ONLY)


解决方案

您可以使用$

访问内部类

  java.nio.channels.FileChannel $ MapMode / READ_ONLY 


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)

解决方案

You access inner classes with $

java.nio.channels.FileChannel$MapMode/READ_ONLY

这篇关于如何通过Clojure interop访问静态内部Java类?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆