home *** CD-ROM | disk | FTP | other *** search
/ PC Professionell 2004 December / PCpro_2004_12.ISO / files / webserver / xampp / xampp-cocoon-addon-1.4.9-installer.exe / DateWrapper.class (.txt) < prev    next >
Encoding:
Java Class File  |  2004-07-12  |  2.2 KB  |  59 lines

  1. package org.apache.cocoon.forms.samples.bindings;
  2.  
  3. import java.util.HashMap;
  4. import java.util.Map;
  5. import java.util.StringTokenizer;
  6.  
  7. public class DateWrapper {
  8.    private Map split = new HashMap();
  9.  
  10.    public DateWrapper(String day, String month, String year) {
  11.       this.setDay(day);
  12.       this.setMonth(month);
  13.       this.setYear(year);
  14.    }
  15.  
  16.    public String getCombined() {
  17.       return "" + this.getDay() + "/" + this.getMonth() + "/" + this.getYear();
  18.    }
  19.  
  20.    public void setCombined(String fullDate) {
  21.       StringTokenizer st = new StringTokenizer(fullDate, "/");
  22.       this.setDay(st.nextToken());
  23.       this.setMonth(st.nextToken());
  24.       this.setYear(st.nextToken());
  25.    }
  26.  
  27.    public Map getSplit() {
  28.       return this.split;
  29.    }
  30.  
  31.    public String getDay() {
  32.       return this.split.get("day").toString();
  33.    }
  34.  
  35.    public void setDay(String day) {
  36.       this.split.put("day", day);
  37.    }
  38.  
  39.    public String getMonth() {
  40.       return this.split.get("month").toString();
  41.    }
  42.  
  43.    public void setMonth(String month) {
  44.       this.split.put("month", month);
  45.    }
  46.  
  47.    public String getYear() {
  48.       return this.split.get("year").toString();
  49.    }
  50.  
  51.    public void setYear(String year) {
  52.       this.split.put("year", year);
  53.    }
  54.  
  55.    public String toString() {
  56.       return "Wrapped Date as combined='" + this.getCombined() + "' as split=[" + this.getDay() + ", " + this.getMonth() + ", " + this.getYear() + "]";
  57.    }
  58. }
  59.