/* DO NOT EDIT: File is auto-generated */
package <%= enumeration.data_module.ee.data_type_package %>;

<%= description_javadoc_for(enumeration, "") %>@javax.annotation.Generated( "Domgen" )
@SuppressWarnings( { "UnusedDeclaration", "JavaDoc" } )
<% if enumeration.jaxb?
%>@javax.xml.bind.annotation.XmlType( name = "<%= enumeration.name %>Type"<%= namespace_annotation_parameter(enumeration.xml) %> )
@javax.xml.bind.annotation.XmlEnum( java.lang.String.class )<% end %>
public enum <%= enumeration.ee.name %>
  implements java.io.Serializable
{
  <%= enumeration.values.collect {|k| "#{k}" } .join(",\n  ") %>
}

/* DO NOT EDIT: File is auto-generated */
package <%= enumeration.data_module.ee.data_type_package %>;

<%= description_javadoc_for(enumeration, "") %>@javax.annotation.Generated( "Domgen" )
@SuppressWarnings( { "UnusedDeclaration", "JavaDoc" } )
<% if enumeration.jaxb?
%>@javax.xml.bind.annotation.XmlType( name = "<%= enumeration.name %>Type"<%= namespace_annotation_parameter(enumeration.xml) %> )
@javax.xml.bind.annotation.XmlEnum( java.lang.String.class )<% end %>
public enum <%= enumeration.ee.name %>
  implements java.io.Serializable
{
  <%= enumeration.values.collect {|k| "#{k}" } .join(",\n  ") %>;

<% if enumeration.jackson? -%>
<% if enumeration.textual_values? -%>
  @org.codehaus.jackson.annotate.JsonValue
  public String value()
  {
    return super.name();
  }

  @org.codehaus.jackson.annotate.JsonCreator
  public static <%= enumeration.ee.name %> fromValue( final String typeCode )
  {
    for( final <%= enumeration.ee.name %> c: <%= enumeration.ee.name %>.values() )
    {
      if( c.name().equals( typeCode ) )
      {
        return c;
      }
    }
    throw new IllegalArgumentException( "Invalid <%= enumeration.ee.name %> type code: " + typeCode );
}
<% else -%>
  @org.codehaus.jackson.annotate.JsonValue
  public int value()
  {
    return super.ordinal();
  }

  @org.codehaus.jackson.annotate.JsonCreator
  public static <%= enumeration.ee.name %> fromValue( final int typeCode )
  {
    for( final <%= enumeration.ee.name %> c: <%= enumeration.ee.name %>.values() )
    {
      if( c.ordinal() == typeCode )
      {
        return c;
      }
    }
    throw new IllegalArgumentException( "Invalid <%= enumeration.ee.name %> type code: " + typeCode );
}
<% end -%>
<% end -%>
}

Rework the way enumerations are serialized to json to match historic behaviour
Rework the way enumerations are serialized to json to match historic behaviour
