ChineSouad / google-gson

Automatically exported from code.google.com/p/google-gson
0 stars 0 forks source link

patch for GsonBuilder.addTypeAdaptersForDate() to register java.sql.Date handler #254

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
The serialized format of java.sql.Date is forced to "MMM d, yyyy".
Please consider the attached patch wherein DefaultJavaSQLDateTypeAdapter is 
expanded to behave like DefaultDateTypeAdapter.  
GsonBuilder.addTypeAdaptersForDate() registers a default pattern string or 
style for java.sql.Date.  Consequently, GsonBuilder.setDateFormat() creates the 
desired date formatting for java.util.Date and java.sql.Date.

This seemed like a reasonable enhancement considering the explicit 
java.sql.Date support added in issue #134 (r513).

Original issue reported on code.google.com by dvs...@gmail.com on 22 Oct 2010 at 3:39

Attachments:

GoogleCodeExporter commented 9 years ago
If we fixed issue 164, the default date handlers would catch SQL dates 
automatically.

Original comment by limpbizkit on 4 Nov 2010 at 10:42

GoogleCodeExporter commented 9 years ago
Fixed by r762.

Original comment by limpbizkit on 29 Mar 2011 at 9:53

GoogleCodeExporter commented 9 years ago

Original comment by limpbizkit on 29 Mar 2011 at 9:53