com.ksc.mission.base.codegen.CodeGenerator Maven / Gradle / Ivy
package com.ksc.mission.base.codegen;
import com.ksc.mission.base.relatedobjects.IOwnedService;
import com.ksc.mission.base.relatedobjects.OwnedList;
import com.ksc.mission.base.relatedobjects.OwnedObject;
import com.ksc.mission.base.relatedobjects.OwningContainer;
public class CodeGenerator extends OwnedObject implements IOwnedService {
private static final long serialVersionUID = 1L;
public String resourcePath = "src/main/resources/";
public String outputPath = "output/";
final public OwnedList templateTypes = new OwnedList(TemplateType.class, this);
final public OwnedList models = new OwnedList(Model.class, this);
public void init() {
initialize("Models.csv","TemplateTypes.csv");
setOutputPath("output/");
subscribe("#Generate", msg -> generate());
}
public void initialize(String modelFileName, String templateTypeFileName) {
templateTypes.initializeFromFilePath(resourcePath + templateTypeFileName);
models.initializeFromFilePath(resourcePath + modelFileName);
}
public void generate() {
for(Model model : models) model.generateAll();
}
public boolean isRoot() {
return true;
}
public String getOutputPath() {
return outputPath;
}
public void setOutputPath(String outputPath) {
this.outputPath = outputPath;
}
public OwnedList getModels() {
return models;
}
}