Created
March 25, 2014 15:11
-
-
Save ipolevoy/9763819 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
Person p = new Person(); | |
p.set("first_name", "Marilyn","last_name", "Monroe"); | |
p.set("dob", "1926/6/1"); //wrong format | |
p.validate(); | |
System.out.println(p.errors().get("dob")); //prints out: attribute dob does not conform to format: yyyy-MM-dd | |
p.set("dob", "1926-06-01"); //right format | |
p.validate(); | |
System.out.println(p.get("dob").getClass()); //prints out: class java.sql.Date | |
System.out.println(p.get("dob")); //prints out: 1926-06-01 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment