@@ -0,0 +1,1400 @@
+public abstract class CodeGenerator %7B%0A%0A%09protected CodeGenConfig configuration;%09%0A%09protected Entity entity;%0A%09protected Schema schema;%0A%09public CodeGenerator(CodeGenConfig configuration, Entity entity) %7B%0A%09%09super();%0A%09%09this.configuration = configuration;%0A%09%09this.entity = entity;%0A%09%7D%0A%09public CodeGenerator(CodeGenConfig configuration, Schema schema) %7B%0A%09%09super();%0A%09%09this.configuration = configuration;%0A%09%09this.schema = schema;%0A%09%7D%0A%09%0A%09%0A%09%0A%09%0A%09protected void writeCode(CodeGenConfig config, File dir, String fileName,%0A%09%09%09String code) throws IOException %7B%0A%09%09File fj = new File(dir, fileName);%0A%09%09if (configuration.getOverwriteStrategy() == CodeOverwriteStrategy.IGNORE%0A%09%09%09%09&& fj.exists()) %7B%0A%09%09%09return;%0A%09%09%7D else if (configuration.getOverwriteStrategy() == CodeOverwriteStrategy.RENAME_EXISTING%0A%09%09%09%09&& fj.exists()) %7B%0A%09%09%09File newFile = null;%0A%09%09%09for (int i = 1; i %3C Integer.MAX_VALUE; i++) %7B%0A%09%09%09%09newFile = new File(dir, String.format(%22%25s.%2503d%22, fileName, i));%0A%09%09%09%09if (!newFile.exists()) %7B%0A%09%09%09%09%09break;%0A%09%09%09%09%7D%0A%09%09%09%7D%0A%09%09%09if(!fj.renameTo(newFile))%7B%0A%09%09%09%09throw new IOException(%22Failed to rename existing file%22);%0A%09%09%09%7D%09%09%09%0A%09%09%7D else if (fj.exists()) %7B%0A%09%09%09for (int i = 1; i %3C Integer.MAX_VALUE; i++) %7B%0A%09%09%09%09fj = new File(dir, String.format(%22%25s.%2503d%22, fileName, i));%0A%09%09%09%09if (!fj.exists()) %7B%0A%09%09%09%09%09break;%0A%09%09%09%09%7D%0A%09%09%09%7D%0A%09%09%7D%0A%09%09FileWriter fw = new FileWriter(fj);%0A%09%09try %7B%0A%09%09%09fw.write(code);%0A%09%09%09fw.flush();%0A%09%09%7D finally %7B%0A%09%09%09fw.close();%0A%09%09%7D%0A%09%7D%0A%0A%7D%0A

Create CodeGenerator.java