Thank you Stephen, the problem is that it is impossible to create create a Java class using closure with the following characteristics:
1) all methods must match given Java signature. For example, if I need a method public String getSomeString(); all I get is public Object getSomeString(); closure ignores my String hints and always uses Object instead. 2) must be no references to any closure classes. Now the closure compiler unconditionally creates at least one extra method public static IPersistentVector getBasis() which references several classes from closure runtime. Regards, Vladimir On Sat, 2012-11-03 at 13:57 -0700, Vladimir Tsichevski wrote: > > In one of my purely Java project I have to create hundreds of java > classes > > with repeatable structure, so the task is an excellent candidate for > > automation. I hoped I will be able to create these classes with the > latest > > closure, using the 'deftype' construct. > > If you know all the details of classes to create at compile time, you > can use macros instead, which are perfectly well able to output deftype > forms. Untested: > > (defmacro defrefs > "Make a bunch of :x boxes." > [& names] > `(do ~@(map (fn [name] `(defrecord ~name [~'x])) names))) > > ;; makes classes foo, bar, baz, qux, quux, all with the :x field. > (defrefs foo bar baz qux quux) > > -- > Stephen Compall > ^aCollection allSatisfy: [:each|aCondition]: less is better > > > -- 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