KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > calipso > reportgenerator > reportcalculator > SharedData


1 package com.calipso.reportgenerator.reportcalculator;
2
3 import com.calipso.reportgenerator.reportdefinitions.types.ReportDataType;
4 import com.calipso.reportgenerator.common.InfoException;
5 import com.calipso.common.DateEx;
6
7 /**
8  *
9  * User: Breto
10  * Date: 30/09/2005
11  * Time: 17:54:05
12  *
13  */

14 public abstract class SharedData {
15
16
17   public String JavaDoc getStringSimpleValue(){
18     return getValue().toString();
19   }
20
21   public abstract Object JavaDoc getValue();
22
23   public static Object JavaDoc newFrom(int dataType, String JavaDoc value) throws InfoException {
24     switch(dataType){
25       case ReportDataType.BOOLEAN_TYPE:
26         return new Boolean JavaDoc(value);
27       case ReportDataType.DATE_TYPE:
28       case ReportDataType.DATETIME_TYPE:
29         DateEx ex = new DateEx(value);
30         return SharedDate.newFrom(ex);
31       case ReportDataType.FLOAT_TYPE:
32         return SharedFloat.newFrom(new Float JavaDoc(value));
33       case ReportDataType.INTEGER_TYPE:
34         return SharedInteger.newFrom(new Integer JavaDoc(value));
35       case ReportDataType.STRING_TYPE:
36         return value.intern();//SharedString.newFrom(value);
37
}
38     return null;
39   }
40 }
41
Popular Tags