1 48 49 package com.caucho.hessian.io; 50 51 import java.util.Calendar ; 52 import java.util.Date ; 53 import java.util.GregorianCalendar ; 54 55 58 public class CalendarHandle implements java.io.Serializable { 59 private Class type; 60 private Date date; 61 62 public CalendarHandle(Class type, long time) 63 { 64 if (! GregorianCalendar .class.equals(type)) 65 this.type = type; 66 67 this.date = new Date (time); 68 } 69 70 private Object readResolve() 71 { 72 try { 73 Calendar cal; 74 75 if (this.type != null) 76 cal = (Calendar ) this.type.newInstance(); 77 else 78 cal = new GregorianCalendar (); 79 80 cal.setTimeInMillis(this.date.getTime()); 81 82 return cal; 83 } catch (RuntimeException e) { 84 throw e; 85 } catch (Exception e) { 86 throw new RuntimeException (e); 87 } 88 } 89 } 90 | Popular Tags |