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

Groovy Convert String to Enum

Enum is a very convenient way of representing a group of information that is fairly static. For example, Sex, Marital Status, and such can be represented by Enum. Enum is great way to do things instead of constant because it is more intuitive and easy to work with. However, when we store Enums to database or transfer it as a message to another process, we convert it into String. The question now is, how do we turn back a String to Enum? Below are some examples that converts a String to Enum in Groovy. And we know that Groovy has beautiful magic to do this.



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

Share the post

Groovy Convert String to Enum

×

Subscribe to Javadevnotes

Get updates delivered right to your inbox!

Thank you for your subscription

×