On Jan 12, 12:50 pm, Konrad Hinsen <konrad.hin...@fastmail.net> wrote: > On 11 Jan 2010, at 23:09, .Bill Smith wrote: > > > Every class object has a newInstance method: > > > user=> (Class/forName "java.util.HashMap") > > java.util.HashMap > > user=> (.newInstance (Class/forName "java.util.HashMap")) > > #<HashMap {}> > > user=> > > > Is that what you are looking for? > > It seems close, but it doesn't work for me. From experimenting I have > the impression that this works only for constructors with no arguments.
The Class object can give you the exact constructor object (with argument foo): http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Class.html#getConstructor(java.lang.Class...) and then you can call the newInstance(fooObject) method on the constructor object to create object with parameter foo. http://java.sun.com/j2se/1.5.0/docs/api/java/lang/reflect/Constructor.html#newInstance(java.lang.Object...) HTH Regards, Shantanu
-- 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