01: package com.calipso.reportgenerator.reportcalculator;
02:
03: import com.calipso.reportgenerator.reportdefinitions.types.ReportDataType;
04: import com.calipso.reportgenerator.common.InfoException;
05: import com.calipso.common.DateEx;
06:
07: /**
08: *
09: * User: Breto
10: * Date: 30/09/2005
11: * Time: 17:54:05
12: *
13: */
14: public abstract class SharedData {
15:
16: public String getStringSimpleValue() {
17: return getValue().toString();
18: }
19:
20: public abstract Object getValue();
21:
22: public static Object newFrom(int dataType, String value)
23: throws InfoException {
24: switch (dataType) {
25: case ReportDataType.BOOLEAN_TYPE:
26: return new Boolean(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(value));
33: case ReportDataType.INTEGER_TYPE:
34: return SharedInteger.newFrom(new Integer(value));
35: case ReportDataType.STRING_TYPE:
36: return value.intern();//SharedString.newFrom(value);
37: }
38: return null;
39: }
40: }
|