clojure - Generating Java Classes -
i understand 1 can use gen-class
generate java class, however, i'm confused how can generate java class with constructors. possible generate java class constructor, not extend or implement class?
i generated following class 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 able create instance of it:
user> (test.t1. (java.util.hashmap.)) #<t1 test.t1@7d6ac92e>
Comments
Post a Comment