1 48 49 package com.caucho.hessian.io; 50 51 import java.io.IOException ; 52 import java.util.Date ; 53 54 57 public class SqlDateSerializer extends AbstractSerializer { 58 public void writeObject(Object obj, AbstractHessianOutput out) 59 throws IOException 60 { 61 if (obj == null) 62 out.writeNull(); 63 else { 64 Class cl = obj.getClass(); 65 66 if (out.addRef(obj)) 67 return; 68 69 int ref = out.writeObjectBegin(cl.getName()); 70 71 if (ref < 0) { 72 out.writeString("value"); 73 out.writeUTCDate(((Date ) obj).getTime()); 74 out.writeMapEnd(); 75 } 76 else { 77 if (ref == 0) { 78 out.writeInt(1); 79 out.writeString("value"); 80 } 81 82 out.writeUTCDate(((Date ) obj).getTime()); 83 } 84 } 85 } 86 } 87 | Popular Tags |