1 package org.kuali.api.jaxb;
2
3 import javax.xml.bind.annotation.adapters.XmlAdapter;
4 import java.sql.Date;
5 import java.text.DateFormat;
6 import java.text.SimpleDateFormat;
7
8
9
10
11
12
13
14
15 public class DateAdapter extends XmlAdapter<String, Date> {
16
17 @Override
18 public Date unmarshal(String dateString) throws Exception {
19 DateFormat formater = new SimpleDateFormat("yyyy-MM-dd");
20 java.util.Date date = formater.parse(dateString);
21 java.sql.Date sqlDate= new java.sql.Date(date.getTime());
22 return sqlDate;
23 }
24
25 @Override
26 public String marshal(Date v) throws Exception {
27 return v.toString();
28 }
29
30 }