1 16 package org.apache.cocoon.woody.datatype; 17 18 19 23 public class Sex { 24 25 public static final Sex MALE = new Sex("M"); 26 public static final Sex FEMALE = new Sex("F"); 27 private String code; 28 29 private Sex(String code) { this.code = code; } 30 31 public String toString() { 32 switch(code.charAt(0)) { 34 case 'M' : return this.getClass().getName() + ".MALE"; 35 case 'F' : return this.getClass().getName() + ".FEMALE"; 36 default : return "unknown"; } 38 } 39 } 40 | Popular Tags |