1 16 package org.apache.cocoon.forms.samples.bindings; 17 18 import java.util.HashMap ; 19 import java.util.Map ; 20 import java.util.StringTokenizer ; 21 22 30 public class DateWrapper { 31 32 private Map split = new HashMap (); 33 34 public DateWrapper(String day, String month, String year) { 35 setDay(day); 36 setMonth(month); 37 setYear(year); 38 } 39 40 public String getCombined() { 41 return "" + getDay() +"/" + getMonth() + "/" + getYear(); 42 } 43 44 45 public void setCombined(String fullDate) { 46 StringTokenizer st = new StringTokenizer (fullDate, "/"); 47 setDay(st.nextToken()); 48 setMonth(st.nextToken()); 49 setYear(st.nextToken()); 50 } 51 52 public Map getSplit() { 53 return this.split; 54 } 55 56 59 public String getDay() { 60 return split.get("day").toString(); 61 } 62 65 public void setDay(String day) { 66 split.put("day", day); 67 } 68 71 public String getMonth() { 72 return split.get("month").toString(); 73 } 74 77 public void setMonth(String month) { 78 split.put("month", month); 79 } 80 83 public String getYear() { 84 return split.get("year").toString(); 85 } 86 89 public void setYear(String year) { 90 split.put("year", year); 91 } 92 93 public String toString() { 94 return "Wrapped Date as combined='" + getCombined() + "' as split=[" 95 + getDay() + ", " + getMonth() + ", " + getYear() + "]"; 96 } 97 } 98 | Popular Tags |