From: Patrick W. <th...@pd...> - 2002-11-20 03:04:25
|
Hi everybody I downloaded WM about two months ago; I had seen it a few years ago and never got to use it. Anyway, I'm in the process of developing some extensions to facilitate certain types of code generation. My goal is to have a basic templating language that allows me to quickly create code-generation templates for Java, SQL and other languages. The key is that I'm trying to make it be terse and yet still expressive, to avoid all the string manipulation and conditional logic normally associated with code generation templates. So far I'm working on a set of classes that map database metadata using JDBC, and testing them in different configurations to see how useful they are, and what methods make the most sense, etc. There are also some general purpose classes that I'm putting into the Context to facilitate things like adding commas to lists (but skipping the first or last comma), replacing null values, etc. I had started doing this as Directives, but found that was rather laborious--so I have very simple classes used instead. For example, the TableMD (MD=metadata) class represents a single SQL table's metadata read from the DB, and its getColumns() method returns a list of ColumnMD instances (which are column metadata). The ColumnMD supports the most obvious things you'd do with a column in a template, like $column.AsJavaMember--converts the column name into an equivalent Java member field name (the format of this will be controllable in the future) $column.AsJavaAccessor--same, but gives the accessor (get...) name $column.AsJavaDataType--the equivalent Java type for the column Once I have a complete set (of anything) I will post to somewhere, maybe SourceForge or Savannah. I'm looking forward to JEdit integration as well. Question to you all: I came across Velocity on the Apache site, and was surprised how similar many of their commands look to WM. Are the code-bases shared, was there a common ancestor, what gives? Thanks to everybody who contributed to WM, by the way. Both the Directive design and the extensions I'm able to do with regular classes have shown it to be very flexible and easy to develop with. Also, I'm looking forward to the #macro Directive, as I was just wanting to code one of those... Patrick Patrick Wright Open Guild, LLC http://www.openguild.net |