title: Grails bind request parameters to enum
body: <p>My Grails application has a large number of enums that look like this:</p>
  
  <pre><code>public enum Rating {
      BEST("be"), GOOD("go"), AVERAGE("av"), BAD("ba"), WORST("wo")
      final String id
  
      private RateType(String id) {
          this.id = id
      }
  
      static public RateType getEnumFromId(String value) {
          values().find {it.id == value }
      }   
  }
  </code></pre>
  
  <p>If I have a command object such as this:</p>
  
  <pre><code>class MyCommand {
      Rating rating
  }
  </code></pre>
  
  <p>I would like to (for example) automatically convert a request parameter with value "wo" to Rating.WORST.</p>
  
  <p>The procedure for defining custom converters is described <a href="https://stackoverflow.com/questions/963922/grails-date-unmarshalling">here</a> (in the context of converting Strings to Dates). Although this procedure works fine, I don't want to have to create a class implementing PropertyEditorSupport for each of my enums. Is there a better alternative?</p>