import org.webmacro.*; import java.io.FileOutputStream; public class BeanBuilder { public static void main(String args[]) throws Exception { String packageName = "mybean"; String imports[] = {"java.lang.String", "java.util.Date"}; String name = "Appointment"; Property prop1 = new Property(); Property prop2 = new Property(); prop1.setName("appt"); prop1.setCapName("Appt"); prop1.setType("String"); prop2.setName("date"); prop2.setCapName("Date"); prop2.setType("Date"); Property properties[] = {prop1, prop2}; WM webmacro = new WM(); Context context = new Context(webmacro.getBroker()); context.put("packageName", packageName); context.put("imports", imports); context.put("name", name); context.put("properties", properties); Template template = webmacro.getTemplate("bean.template"); FastWriter writer = webmacro.getFastWriter(new FileOutputStream("Appointment.java"), "UTF8"); template.write(writer, context); writer.close(); } }