Generating Java Classes
I understand that one can use gen-class
to generate a java class, however, I'm confused as to how I can开发者_开发问答 generate a java class with constructors. Is it possible to generate a java class with a constructor, that does not extend or implement another class?
I just generated following class with constructor:
(ns test.t1
(:import (java.util HashMap))
(:gen-class
:main false
:state state
:init init
:constructors {[java.util.HashMap] []}))
(defn -init [^HashMap tmapref]
[[] tmapref])
and I able to create instance of it:
user> (test.t1. (java.util.HashMap.))
#<t1 test.t1@7d6ac92e>
精彩评论