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

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: Re-upload after revert Created 6 years, 5 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
4 {% macro struct_def(struct, inner_class=False) %}
5 {{'static' if inner_class else 'public'}} final class {{struct|name}} extends or g.chromium.mojo.bindings.Struct {
6 {% for constant in struct.constants %}
7
8 {{constant_def(constant)|indent(4)}}
9 {% endfor %}
10 {% for enum in struct.enums %}
11
12 {{enum_def(enum, false)|indent(4)}}
13 {% endfor %}
14 {% if struct.fields %}
15
16 {% for field in struct.fields %}
17 public {{field.kind|java_type}} {{field|name}};
18 {% endfor %}
19 {% endif %}
20
21 public {{struct|name}}() {
22 {% for field in struct.fields %}
23 {% if field.default %}
24 {{field|name}} = {{field|default_value}};
25 {% elif field.kind|is_handle %}
26 {{field|name}} = org.chromium.mojo.system.InvalidHandle.INSTANCE;
27 {% endif %}
28 {% endfor %}
29 }
30
31 }
32 {% endmacro %}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698