Created
April 11, 2014 15:31
-
-
Save sankars/10478115 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public enum Blah { | |
| A("text1"), | |
| B("text2"), | |
| C("text3"), | |
| D("text4"); | |
| private String text; | |
| Blah(String text) { | |
| this.text = text; | |
| } | |
| public String getText() { | |
| return this.text; | |
| } | |
| public static Blah fromString(String text) { | |
| if (text != null) { | |
| for (Blah b : Blah.values()) { | |
| if (text.equalsIgnoreCase(b.text)) { | |
| return b; | |
| } | |
| } | |
| } | |
| return null; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment