Extend abstract types

This commit is contained in:
Lonami Exo 2018-07-23 19:16:05 +02:00
parent 1836837245
commit 389cdae3ec
1 changed files with 7 additions and 2 deletions

View File

@ -18,7 +18,7 @@ public class Generator {
writeAbstract(writer, types); writeAbstract(writer, types);
} }
try (final Writer writer = new BufferedWriter(new FileWriter(typesFile))) { try (final Writer writer = new BufferedWriter(new FileWriter(typesFile))) {
writeCode(writer, "Types", "TLObject", types); writeCode(writer, "Types", null, types);
} }
try (final Writer writer = new BufferedWriter(new FileWriter(functionsFile))) { try (final Writer writer = new BufferedWriter(new FileWriter(functionsFile))) {
writeCode(writer, "Functions", "TLRequest", functions); writeCode(writer, "Functions", "TLRequest", functions);
@ -68,7 +68,12 @@ public class Generator {
writer.write("public static class "); writer.write("public static class ");
writer.write(TLObject.toCamelCase(object.name)); writer.write(TLObject.toCamelCase(object.name));
writer.write(" extends "); writer.write(" extends ");
if (extendsName == null) {
writer.write("Abstract.");
writer.write(TLObject.toCamelCase(object.type));
} else {
writer.write(extendsName); writer.write(extendsName);
}
writer.write(" {\n"); writer.write(" {\n");
for (int i = 0; i < object.args.size(); ++i) { for (int i = 0; i < object.args.size(); ++i) {