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