View Javadoc
1   package fr.paris.lutece.plugins.aot.modules.declarationimmat.utils;
2   
3   import java.sql.Timestamp;
4   import java.text.SimpleDateFormat;
5   
6   import javax.el.ELException;
7   
8   import de.odysseus.el.misc.TypeConverter;
9   
10  import de.odysseus.el.misc.TypeConverterImpl;
11  
12  public class AOTTypeConverter implements TypeConverter
13  {
14      @Override
15      public <T> T convert( Object value, Class<T> type ) throws ELException
16      {
17          if ( type.isAssignableFrom( String.class ) && value instanceof Timestamp )
18          {
19              SimpleDateFormat formatter = new SimpleDateFormat( "dd/MM/yyyy HH:mm" );
20              return ( T ) formatter.format( value );
21          }
22  
23          return new TypeConverterImpl( ).convert( value, type );
24      }
25  
26  }