aboutsummaryrefslogtreecommitdiffstats
path: root/src/vpp-api/java/jvpp/gen/jvppgen/dto_gen.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/vpp-api/java/jvpp/gen/jvppgen/dto_gen.py')
-rw-r--r--src/vpp-api/java/jvpp/gen/jvppgen/dto_gen.py49
1 files changed, 37 insertions, 12 deletions
diff --git a/src/vpp-api/java/jvpp/gen/jvppgen/dto_gen.py b/src/vpp-api/java/jvpp/gen/jvppgen/dto_gen.py
index e831557c15a..e94bbc5cb28 100644
--- a/src/vpp-api/java/jvpp/gen/jvppgen/dto_gen.py
+++ b/src/vpp-api/java/jvpp/gen/jvppgen/dto_gen.py
@@ -35,6 +35,23 @@ $methods
}
""")
+dto_template_typeless = Template("""
+package $plugin_package.$dto_package;
+
+/**
+ * <p>This class represents $description.
+ * <br>It was generated by dto_gen.py based on $inputfile preparsed data:
+ * <pre>
+$docs
+ * </pre>
+ */
+public final class $cls_name {
+
+$fields
+$methods
+}
+""")
+
field_template = Template(""" public $type $name;\n""")
send_template = Template(""" @Override
@@ -93,9 +110,7 @@ def generate_dtos(func_list, base_package, plugin_package, plugin_name, dto_pack
# for structures that are also used as notifications, generate dedicated notification DTO
if util.is_notification(func["name"]):
- base_type = "JVppNotification"
description = "notification DTO"
- camel_case_dto_name = util.add_notification_suffix(camel_case_dto_name)
dto_path = os.path.join(dto_package, camel_case_dto_name + ".java")
methods = generate_dto_base_methods(camel_case_dto_name, func)
write_dto_file(base_package, plugin_package, base_type, camel_case_dto_name, description, dto_package,
@@ -229,16 +244,26 @@ def generate_dto_hash(func):
def write_dto_file(base_package, plugin_package, base_type, camel_case_dto_name, description, dto_package, dto_path,
fields, func, inputfile, methods):
dto_file = open(dto_path, 'w')
- dto_file.write(dto_template.substitute(inputfile=inputfile,
- description=description,
- docs=util.api_message_to_javadoc(func),
- cls_name=camel_case_dto_name,
- fields=fields,
- methods=methods,
- base_package=base_package,
- plugin_package=plugin_package,
- base_type=base_type,
- dto_package=dto_package))
+ if base_type != "":
+ dto_file.write(dto_template.substitute(inputfile=inputfile,
+ description=description,
+ docs=util.api_message_to_javadoc(func),
+ cls_name=camel_case_dto_name,
+ fields=fields,
+ methods=methods,
+ base_package=base_package,
+ plugin_package=plugin_package,
+ base_type=base_type,
+ dto_package=dto_package))
+ else:
+ dto_file.write(dto_template_typeless.substitute(inputfile=inputfile,
+ description=description,
+ docs=util.api_message_to_javadoc(func),
+ cls_name=camel_case_dto_name,
+ fields=fields,
+ methods=methods,
+ plugin_package=plugin_package,
+ dto_package=dto_package))
dto_file.flush()
dto_file.close()