Skip to content

Instantly share code, notes, and snippets.

@b1a9id
Created June 21, 2018 10:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save b1a9id/347be77278fc6831741a746a3b31caa3 to your computer and use it in GitHub Desktop.
Save b1a9id/347be77278fc6831741a746a3b31caa3 to your computer and use it in GitHub Desktop.
TestFormatter
public class TestFormatter implements Formatter<Test> {
@Override
public Test parse(String text, Locale locale) throws ParseException {
if (Objects.isNull(text)) {
return null;
}
return Test.valueOf(text.toUpperCase());
}
@Override
public String print(Test object, Locale locale) {
if (Objects.isNull(object)) {
return null;
}
return object.toString().toLowerCase();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment