public static void genJAVA(Class<?> c, LinkedList<member> members) throws SecurityException,
NoSuchFieldException, IOException {
suffix = ".java";
groupFile = stgPath + "JavaModel.stg";
FileReader fr = new FileReader(groupFile);
StringTemplateGroup templates = new StringTemplateGroup(fr);
fr.close();
templates.registerRenderer(Class.class, new TypeRenderer());
for (member m : members) {
PrintWriter outfile = new PrintWriter(new File(outPutPath
+ m.cls.simpleName + suffix));
StringTemplate classST = templates.getInstanceOf("output");
classST.setAttribute("class", m.cls);
classST.setAttribute("fields", m.fields);
classST.setAttribute("arrayFields", m.arrayFields);
classST.setAttribute("methodFields", m.methodFields);
classST.setAttribute("interfaceImps", m.interfaceImps);
outfile.print(classST);
outfile.flush();
outfile.close();
}
groupFile = stgPath + "Java.stg";
fr = new FileReader(groupFile);
templates = new StringTemplateGroup(fr);
fr.close();
for (member m : members) {
if (!m.cls.isInterface) {
PrintWriter outfile = new PrintWriter(new File(outPutPath
+ m.cls.simpleName + "IO" + suffix));
StringTemplate classST = templates.getInstanceOf("output");
classST.setAttribute("class", m.cls);
classST.setAttribute("fields", m.fields);
classST.setAttribute("arrayFields", m.arrayFields);
classST.setAttribute("methodFields", m.methodFields);
outfile.print(classST);