Created
June 21, 2018 10:24
-
-
Save b1a9id/347be77278fc6831741a746a3b31caa3 to your computer and use it in GitHub Desktop.
TestFormatter
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 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