Chromium Code Reviews| Index: mojo/public/tools/bindings/generators/java_templates/struct_definition.tmpl |
| diff --git a/mojo/public/tools/bindings/generators/java_templates/struct_definition.tmpl b/mojo/public/tools/bindings/generators/java_templates/struct_definition.tmpl |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..1082302986f22d55573b75cc4955a4869067eb62 |
| --- /dev/null |
| +++ b/mojo/public/tools/bindings/generators/java_templates/struct_definition.tmpl |
| @@ -0,0 +1,32 @@ |
| +{% from "constant_definition.tmpl" import constant_def %} |
| +{% from "enum_definition.tmpl" import enum_def %} |
| + |
| +{% macro struct_def(struct, inner_class=False) %} |
| +{{ 'static ' if inner_class else 'public '}}final class {{struct|name}} extends org.chromium.mojo.bindings.Struct { |
|
rmcilroy
2014/06/23 18:09:36
nit - replace "{{ 'static ' if inner_class else '
qsr
2014/06/24 13:23:59
Done.
|
| +{% for constant in struct.constants %} |
| + |
| + {{constant_def(constant)|indent(4)}} |
| +{% endfor %} |
| +{% for enum in struct.enums %} |
| + |
| + {{enum_def(enum, false)|indent(4)}} |
| +{% endfor %} |
| +{% if struct.fields %} |
| + |
| +{% for field in struct.fields %} |
| + public {{field.kind|java_type}} {{field|name}}; |
| +{% endfor %} |
| +{% endif %} |
| + |
| + public {{struct|name}}() { |
| +{% for field in struct.fields %} |
| +{% if field.default %} |
| + {{field|name}} = {{field|default_value}}; |
| +{% elif field.kind|is_handle %} |
| + {{field|name}} = org.chromium.mojo.system.InvalidHandle.INSTANCE; |
| +{% endif %} |
| +{% endfor %} |
| + } |
| + |
| +} |
| +{% endmacro %} |