1 4 package org.oddjob.values.types; 5 6 import java.text.ParseException ; 7 import java.util.Date ; 8 9 import org.oddjob.util.DateHelper; 10 11 35 public class DateType { 36 37 42 private String date; 43 44 49 private String timeZone; 50 51 58 public Date valueFor(Class required) 59 throws ParseException { 60 if (date == null) { 61 return null; 62 } 63 return DateHelper.parseDateTime(date); 64 } 65 66 67 public void setDate(String date) { 68 this.date = date; 69 } 70 71 public String getDate() { 72 return date; 73 } 74 75 public void setTimeZone(String timeZoneId) { 76 this.timeZone = timeZoneId; 77 } 78 79 public String getTimeZone() { 80 return timeZone; 81 } 82 83 public String toString() { 84 try { 85 return valueFor(Object .class).toString(); 86 } catch (ParseException e) { 87 return e.getMessage(); 88 } 89 } 90 } 91 | Popular Tags |