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 / Sex.class (.txt) < prev    next >
Encoding:
Java Class File  |  2004-07-12  |  1008 b   |  23 lines

  1. package org.apache.cocoon.forms.samples;
  2.  
  3. public class Sex {
  4.    public static final Sex MALE = new Sex("M");
  5.    public static final Sex FEMALE = new Sex("F");
  6.    private String code;
  7.  
  8.    private Sex(String code) {
  9.       this.code = code;
  10.    }
  11.  
  12.    public String toString() {
  13.       switch (this.code.charAt(0)) {
  14.          case 'F':
  15.             return this.getClass().getName() + ".FEMALE";
  16.          case 'M':
  17.             return this.getClass().getName() + ".MALE";
  18.          default:
  19.             return "unknown";
  20.       }
  21.    }
  22. }
  23.