View Javadoc
1   package fr.paris.lutece.plugins.aot.modules.declarationimmat.utils;
2   
3   import java.sql.Timestamp;
4   import java.util.Date;
5   
6   import javax.xml.bind.annotation.adapters.XmlAdapter;
7   
8   public class TimestampAdapter extends XmlAdapter<Date, Timestamp>
9   {
10  
11      @Override
12      public Date marshal( Timestamp sqlDate ) throws Exception
13      {
14          if(null == sqlDate) {
15              return null;
16          }
17          return new Date( sqlDate.getTime( ) );
18      }
19  
20      @Override
21      public Timestamp unmarshal( Date utilDate ) throws Exception
22      {
23          if(null == utilDate) {
24              return null;
25          }
26          return new Timestamp( utilDate.getTime( ) );
27      }
28  
29  }