Created
August 12, 2013 18:44
-
-
Save csadilek/6213766 to your computer and use it in GitHub Desktop.
This file contains 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 class EnumConverter implements Converter<Enum<?>, String>{ | |
Class enumType; | |
public EnumConverter(Class enumType) { | |
this.enumType = enumType; | |
} | |
@Override | |
public Enum<?> toModelValue(String widgetValue) { | |
return Enum.valueOf(enumType, widgetValue); | |
} | |
@Override | |
public String toWidgetValue(Enum<?> modelValue) { | |
return modelValue.toString(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment