在Clojure中的gen-class方法声明中声明数组作为返回类型 [英] Declare array as return type in gen-class method declaration in Clojure

查看:111
本文介绍了在Clojure中的gen-class方法声明中声明数组作为返回类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在gen-class的方法声明中声明数组?

 (ns foo.bar 
:gen-class
:methods [[parseString [String Object] Object]]))

那工作正常。但是返回类型实际上是一个数组。



pre> (ns foo.bar
(:gen-class
:methods [[parseString [String Object][Ljava.lang.Object;]]) )


How to declare an array in method declaration in gen-class?

(ns foo.bar
(:gen-class
 :methods [[parseString [String Object] Object]]))

That works fine. But the return type is really an array. How I can declare that so Java can understand it?

解决方案

Try

(ns foo.bar
  (:gen-class
    :methods [[parseString [String Object] "[Ljava.lang.Object;"]]))

这篇关于在Clojure中的gen-class方法声明中声明数组作为返回类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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