Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(430)

Side by Side Diff: mojo/public/tools/bindings/generators/java_templates/struct_definition.tmpl

Issue 306893010: Generate java bindings for structs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Follow review Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 {% from "constant_definition.tmpl" import constant_def %}
2 {% from "enum_definition.tmpl" import enum_def %}
3 {% from "java_macros.tmpl" import build_default %}
4
5 {% macro struct_def(struct, method=None, is_parameter=true) %}
6 {% 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.
7 {{ 'static ' if method else 'public '}}final class {{struct|name}} extends {{met hod|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.
8 {% for constant in struct.constants %}
9
10 {{constant_def(constant)|indent(4)}}
11 {% endfor %}
12 {% for enum in struct.enums %}
13
14 {{enum_def(enum, false)|indent(4)}}
15 {% endfor %}
16 {% if struct.fields %}
17
18 {% for field in struct.fields %}
19 public {{field.kind|java_type}} {{field|name}};
20 {% endfor %}
21 {% endif %}
22
23 public {{struct|name}}() {
24 {% for field in struct.fields %}
25 {% if field.default or field.kind|is_handle %}
26 {{field|name}} = {{build_default(module, field.kind, field.default)|inde nt(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.
27 {% endif %}
28 {% endfor %}
29 }
30
31 }
32 {% endmacro %}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698