On Dec 5, 11:48 am, Christopher Wicklein <[email protected]> wrote:
> Greetings!
>
> I'd like to create an instance of a Java class like this:
>
> let [foo (Bar.)]
>
> but, I'd like the type specified by Bar to not be static, e.g. something like
> this:
>
> let [foo (:type params).]
>
> but, I can't seem to get this to work with any variation of syntax I've
> tried. Is this possible?
>
> Christopher Wicklein <[email protected]>
(defn newInstance [c & args]
(let [types (into-array (map class args))
constr (.getConstructor c types)]
(.newInstance constr (to-array args))))
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en