Multilingual compositing
May. 31st, 2011 04:05 pmI have a UI generator called Compositor that builds an UI from an XML descriptor. It works fine for me, but I was thinking about what other people might want if they were to use it (and sadly, it took me quite a while to give this any serious consideration.). It occurred to me that there are several languages that run in the JVM, and that it shouldn't be to hard to have Compositor work for them too. Surely in the depths they all generate POJOs?
- Groovy
- This was a piece of cake. Groovy is easy if you're familiar with Java, and it didn't do anything very unexpected.
- Scala
- The only problem here was that Scala fields are implemented property-style: the compiler auto-generates getters and setters. That was easily fixed. Blimey, the Scala compiler is slow!
- Jython
- I've only got this partly working because it looks as if the Java class that's generated from a Jython class doesn't contain any of the Jython class methods. Ouch. I think I see where they're hiding, but I need to poke around some more.
- Clojure
- I couldn't get this one to work at all. I found documentation of how to extend a Java class, but I couldn't see how to get the examples to work. I need more Lisp knowledge.
- JRuby
- Haven't tried this one. Whoops.