On Dec 5, 11:48 am, Christopher Wicklein <chr...@wicklein.org> 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 <chr...@wicklein.org>

(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 clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to