// Auto-generated by BoltFFI. Do not edit.
package {{ package_name }};

{{ self::javadoc_block(enumeration.doc, "") }}public enum {{ enumeration.class_name }} {
{%- for variant in enumeration.variants %}
{{ self::javadoc_block(variant.doc, "    ") }}    {{ variant.name }}{% if !loop.last %},{% else %};{% endif %}
{%- endfor %}

    private static final {{ enumeration.class_name }}[] VARIANTS = values();

    static {{ enumeration.class_name }} fromTag(int tag) {
        return VARIANTS[tag];
    }

    int wireTag() {
        return ordinal();
    }

    public static final class Exception extends RuntimeException {
        private final {{ enumeration.class_name }} error;

        Exception({{ enumeration.class_name }} error) {
            super(error.name());
            this.error = error;
        }

        public {{ enumeration.class_name }} getError() {
            return error;
        }
    }

    int nativeValue() {
        return ordinal();
    }

{%- for ctor in enumeration.constructors %}
{% include "render_java/value_type_constructor.txt" %}
{%- endfor %}

{%- for method in enumeration.methods %}
{% include "render_java/value_type_method.txt" %}
{%- endfor %}
}
