1
0
mirror of synced 2026-09-11 00:49:39 +00:00

chore: move enums and second level nested classes into options package (#267)

This commit is contained in:
Yury Semikhatsky
2021-02-08 18:33:38 -08:00
committed by GitHub
parent c2690f925c
commit b77b9b0d20
42 changed files with 56 additions and 36 deletions
@@ -925,6 +925,9 @@ class Interface extends TypeDefinition {
if ("Playwright".equals(jsonName)) {
output.add("import com.microsoft.playwright.impl.PlaywrightImpl;");
}
if (asList("Page", "Frame", "ElementHandle", "Browser", "BrowserContext", "BrowserType", "Mouse", "Keyboard").contains(jsonName)) {
output.add("import com.microsoft.playwright.options.*;");
}
if (jsonName.equals("Route")) {
output.add("import java.nio.charset.StandardCharsets;");
}
@@ -1265,9 +1268,10 @@ public class ApiGenerator {
writer.write(text);
}
}
dir = new File(dir, "options");
for (Enum e : enums.values()) {
List<String> lines = new ArrayList<>();
lines.add(Interface.header);
lines.add(Interface.header.replace("package com.microsoft.playwright;", "package com.microsoft.playwright.options;"));
e.writeTo(lines);
String text = String.join("\n", lines);
try (FileWriter writer = new FileWriter(new File(dir, e.jsonName + ".java"))) {