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..15e289b0a660b123ad917500ddf0c6fed26edbf7 |
| --- /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 %} |
| +{% from "java_macros.tmpl" import build_default %} |
| + |
| +{% macro struct_def(struct, method=None, is_parameter=true) %} |
| +{% set has_response = method.response_parameters %} |
|
rmcilroy
2014/06/05 11:01:17
has_response doesn't seem to be used?
qsr
2014/06/05 11:46:11
Done.
|
| +{{ 'static ' if method else 'public '}}final class {{struct|name}} extends {{method|super_class}} { |
|
rmcilroy
2014/06/05 11:01:17
I'm assuming the super_class filter will be used b
qsr
2014/06/05 11:46:11
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 or field.kind|is_handle %} |
| + {{field|name}} = {{build_default(module, field.kind, field.default)|indent(8)}}; |
|
rmcilroy
2014/06/05 11:01:17
nit - I think it would be clearer to separate out
qsr
2014/06/05 11:46:11
Done.
|
| +{% endif %} |
| +{% endfor %} |
| + } |
| + |
| +} |
| +{% endmacro %} |