1 18 package org.objectweb.speedo.lib; 19 20 import org.objectweb.speedo.api.UserFieldMapping; 21 22 26 public class SqlDateFieldMapping implements UserFieldMapping { 27 28 32 public Class getStorageType() { 33 return java.util.Date .class; 34 } 35 36 40 public Class getMemoryType() { 41 return java.sql.Date .class; 42 } 43 44 49 public Object toMemory(Object storagevalue) { 50 if (storagevalue == null) { 51 return null; 52 } 53 return (storagevalue instanceof java.sql.Date 54 ? storagevalue 55 : new java.sql.Date (((java.util.Date ) storagevalue).getTime())); 56 } 57 58 63 public Object toStorage(Object memoryvalue) { 64 return memoryvalue; 65 } 66 } 67 | Popular Tags |