{%- if attribute.enum_type.size > 0 -%}
{%- if params.package.size > 0 -%} package {{ params.package }}; {%- endif %}
/* DO NOT EDIT | Generated by gyro */
public enum {{ attribute.enum_type }} {
{% for value in attribute.enum_values %} {% if attribute.enum_values.size > 0 %} {%- assign jsonKey = value -%} {%- if attribute.json_values.size > 0 and attribute.json_values[forloop.index0] -%} {%- assign jsonKey = attribute.json_values[forloop.index0] -%} {%- endif -%} {{ value | snake_case | upcase | strip }}("{{ jsonKey }}") {%- if forloop.last == true -%};{%- else -%},{%- endif -%} {%- endif -%} {%- endfor %} private final String jsonValue; {{ attribute.enum_type }}(final String jsonValue) { this.jsonValue = jsonValue; } {% if params.support_annotations.size > 0 %} @android.support.annotation.Nullable {%- endif %} public static {{ attribute.enum_type }} get(final String jsonValue) { for (final {{ attribute.enum_type }} type : {{ attribute.enum_type }}.values()) { if (type.getJsonValue().equals(jsonValue)) { return type; } } return null; } {% if params.support_annotations.size > 0 %} @android.support.annotation.NonNull {%- endif %} public String getJsonValue() { return jsonValue; }
} {%- endif %}