1 {%- macro enum_value(enum, field, index) -%}
3 (int) ({{field.value|expression_to_text('i32')}})
4 {%- elif index == 0 -%}
7 {{enum.fields[index - 1]|name}} + 1
11 {%- macro enum_def(enum, top_level) -%}
12 public {{ 'static ' if not top_level }}final class {{enum|name}} {
14 {% for field in enum.fields %}
15 public static final int {{field|name}} = {{enum_value(enum, field, loop.index0)}};
18 private {{enum|name}}() {}