1 7 8 package com.calipso.reportgenerator.reportdefinitions.types; 9 10 14 import java.io.Serializable ; 15 import java.util.Enumeration ; 16 import java.util.Hashtable ; 17 import org.exolab.castor.xml.Marshaller; 18 import org.exolab.castor.xml.Unmarshaller; 19 20 25 public class ReportDataType implements java.io.Serializable { 26 27 28 32 35 public static final int DATE_TYPE = 0; 36 37 40 public static final ReportDataType DATE = new ReportDataType(DATE_TYPE, "DATE"); 41 42 45 public static final int DATETIME_TYPE = 1; 46 47 50 public static final ReportDataType DATETIME = new ReportDataType(DATETIME_TYPE, "DATETIME"); 51 52 55 public static final int STRING_TYPE = 2; 56 57 60 public static final ReportDataType STRING = new ReportDataType(STRING_TYPE, "STRING"); 61 62 65 public static final int FLOAT_TYPE = 3; 66 67 70 public static final ReportDataType FLOAT = new ReportDataType(FLOAT_TYPE, "FLOAT"); 71 72 75 public static final int INTEGER_TYPE = 4; 76 77 80 public static final ReportDataType INTEGER = new ReportDataType(INTEGER_TYPE, "INTEGER"); 81 82 85 public static final int BOOLEAN_TYPE = 5; 86 87 90 public static final ReportDataType BOOLEAN = new ReportDataType(BOOLEAN_TYPE, "BOOLEAN"); 91 92 95 private static java.util.Hashtable _memberTable = init(); 96 97 100 private int type = -1; 101 102 105 private java.lang.String stringValue = null; 106 107 108 112 private ReportDataType(int type, java.lang.String value) { 113 super(); 114 this.type = type; 115 this.stringValue = value; 116 } 118 119 123 127 public static java.util.Enumeration enumerate() 128 { 129 return _memberTable.elements(); 130 } 132 135 public int getType() 136 { 137 return this.type; 138 } 140 143 private static java.util.Hashtable init() 144 { 145 Hashtable members = new Hashtable (); 146 members.put("DATE", DATE); 147 members.put("DATETIME", DATETIME); 148 members.put("STRING", STRING); 149 members.put("FLOAT", FLOAT); 150 members.put("INTEGER", INTEGER); 151 members.put("BOOLEAN", BOOLEAN); 152 return members; 153 } 155 159 public java.lang.String toString() 160 { 161 return this.stringValue; 162 } 164 170 public static com.calipso.reportgenerator.reportdefinitions.types.ReportDataType valueOf(java.lang.String string) 171 { 172 java.lang.Object obj = null; 173 if (string != null) obj = _memberTable.get(string); 174 if (obj == null) { 175 String err = "'" + string + "' is not a valid ReportDataType"; 176 throw new IllegalArgumentException (err); 177 } 178 return (ReportDataType) obj; 179 } 181 } 182 | Popular Tags |