Created
October 16, 2015 11:53
-
-
Save bekwam/4386133492546a1f945c to your computer and use it in GitHub Desktop.
JavaFX StringConverter for an Enum
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
cbType.setConverter( new StringConverter<SigningArgumentsType>() { // enum SigningArgumentsType; defined all caps | |
@Override | |
public String toString(SigningArgumentsType type) { | |
return StringUtils.capitalize(StringUtils.lowerCase(String.valueOf(type))); | |
} | |
@Override | |
public SigningArgumentsType fromString(String type) { | |
return Enum.valueOf(SigningArgumentsType.class, StringUtils.upperCase(type)); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment