*/
public class JavaTemplate {
public static final String JSON_ANNOTATION = "@JsonProperty";
public File writeOutJavaFile(String key, String outputDirectory, String packageName, ClassFiles classFiles) throws IOException, ClassNotFoundException {
ClassFileData classFileData = classFiles.get(key);
String className = StringHelper.capFirstLetter(key);
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append("package ").append(packageName).append(";\r\n\r\n");
stringBuilder.append("import org.codehaus.jackson.annotate.JsonProperty;\r\n");
for (String importPackageName : classFileData.getImportPackages()) {
stringBuilder.append("import ").append(importPackageName).append(";\r\n");
}
stringBuilder.append("import java.util.*;\r\n\r\n");
stringBuilder.append("public class ").append(className).append(" {\r\n");
for (Map.Entry<String, String> variablesToTypeEntry : classFileData.getMapOfVariablesToTypes().entrySet()) {
String v = variablesToTypeEntry.getKey();
String t = variablesToTypeEntry.getValue();
appendJsonKey(stringBuilder, v).append(" private ").append(t).append(" ").append(v).append(";\r\n");
}
stringBuilder.append("}\r\n");