Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

Convert String to Enum in Groovy

When programming in Grails, sometimes we get a String value that we wish to transform to an Enum. For example, when usually get String value from data passed from form or url parameters. Since Groovy 1.7.6, it is now easy to transform a String into a Enum value. Below are some examples:



This post first appeared on Grails Cookbook, please read the originial post: here

Share the post

Convert String to Enum in Groovy

×

Subscribe to Grails Cookbook

Get updates delivered right to your inbox!

Thank you for your subscription

×