<% @enums.each do |enum| -%>
<%= enum[:name] %>.java
package io.cucumber.messages.types;

// Generated code
@SuppressWarnings("unused")
public enum <%= enum[:name] %> {
<% enum[:values].each_with_index do |value, index| -%>

    <%= enum_constant(value) %>("<%= value %>")<%= index < enum[:values].length-1 ? ',' : ';' %>
<% end -%>

    private final String value;

    <%= enum[:name] %>(String value) {
        this.value = value;
    }

    @Override
    public String toString() {
        return this.value;
    }

    public String value() {
        return this.value;
    }

    public static <%= enum[:name] %> fromValue(String value) {
        for (<%= enum[:name] %> v : values()) {
            if (v.value.equals(value)) {
                return v;
            }
        }
        throw new IllegalArgumentException(value);
    }
}
<% end -%>
