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 14 public abstract class SharedData { 15 16 17 public String getStringSimpleValue(){ 18 return getValue().toString(); 19 } 20 21 public abstract Object getValue(); 22 23 public static Object newFrom(int dataType, String value) 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(); } 38 return null; 39 } 40 } 41 | Popular Tags |