KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > thoughtworks > xstream > converters > extended > SqlDateConverter


1 package com.thoughtworks.xstream.converters.extended;
2
3 import com.thoughtworks.xstream.converters.basic.AbstractBasicConverter;
4
5 import java.sql.Date JavaDoc;
6 import java.sql.Time JavaDoc;
7
8 /**
9  * Converts a java.sql.Date to text.
10  *
11  * @author Jose A. Illescas
12  */

13 public class SqlDateConverter extends AbstractBasicConverter {
14
15     public boolean canConvert(Class JavaDoc type) {
16         return type.equals(Date JavaDoc.class);
17     }
18
19     protected Object JavaDoc fromString(String JavaDoc str) {
20         return Date.valueOf(str);
21     }
22
23 }
24
Popular Tags