Fix BuildPlan
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Dieser Commit ist enthalten in:
yoyosource 2022-09-23 09:00:22 +02:00
Ursprung 9eb18d9626
Commit a25ea3878d

Datei anzeigen

@ -33,7 +33,7 @@ public class BuildPlan implements Writer {
private Set<String> imports = new HashSet<>(); private Set<String> imports = new HashSet<>();
private final String className; private final String className;
private Map<String, FieldBuilder> fieldBuilderMap = new HashMap<>(); private List<FieldBuilder> fieldBuilders = new ArrayList<>();
private Map<String, MethodBuilder> methodBuilderMap = new HashMap<>(); private Map<String, MethodBuilder> methodBuilderMap = new HashMap<>();
private List<String> staticLines = new ArrayList<>(); private List<String> staticLines = new ArrayList<>();
@ -42,15 +42,7 @@ public class BuildPlan implements Writer {
} }
public void addField(FieldBuilder fieldBuilder) { public void addField(FieldBuilder fieldBuilder) {
fieldBuilderMap.putIfAbsent(fieldBuilder.getType(), fieldBuilder); fieldBuilders.add(fieldBuilder);
}
public boolean hasField(String type) {
return fieldBuilderMap.containsKey(type);
}
public String getFieldName(String type) {
return fieldBuilderMap.get(type).getFieldName();
} }
public void addMethod(MethodBuilder methodBuilder) { public void addMethod(MethodBuilder methodBuilder) {
@ -76,8 +68,8 @@ public class BuildPlan implements Writer {
} }
writer.write("\n"); writer.write("\n");
writer.write("public class " + className + " {\n"); writer.write("public class " + className + " {\n");
if (!fieldBuilderMap.isEmpty()) { if (!fieldBuilders.isEmpty()) {
for (FieldBuilder fieldBuilder : fieldBuilderMap.values()) { for (FieldBuilder fieldBuilder : fieldBuilders) {
fieldBuilder.write(writer); fieldBuilder.write(writer);
} }
writer.write("\n"); writer.write("\n");