Support several templates

This commit is contained in:
Johan Maasing 2025-03-19 21:35:50 +01:00
parent 145a8672ab
commit 92098b1a3b
Signed by: johan
GPG key ID: FFD31BABEE2DEED2

View file

@ -19,6 +19,7 @@ public class TargetGenerator {
public static String ENDPOINTS_TEMPLATE_NAME = "endpoints.ftl";
private final List<EndpointNode> endpoints;
private final List<DataTypeNode> dataTypes;
private final boolean verbose ;
public static class TargetGeneratorException extends Exception {
public TargetGeneratorException(Exception cause) {
@ -27,12 +28,13 @@ public class TargetGenerator {
}
public TargetGenerator(
final boolean verbose,
boolean verbose,
Path outputPath,
Path templatePath,
List<EndpointNode> endpoints,
List<DataTypeNode> dataTypes
) {
this.verbose = verbose;
this.outputPath = Objects.requireNonNull(
outputPath,
"Output path is required"
@ -66,6 +68,9 @@ public class TargetGenerator {
StandardOpenOption.CREATE,
StandardOpenOption.TRUNCATE_EXISTING
)) {
if (this.verbose) {
System.out.println("Processing " + template);
}
HashMap<String, Object> templateData = new HashMap<>();
templateData.put("endpoints", endpoints);
templateData.put("datatypes", dataTypes);