/**
  * set parameter choice value. The string value is in English locale, and needs to be parsed back
  * into object value based on the data type.
  *
  * @param value the string value for the object
  * @param type the parameter data type
  */
 public void setValue(String value, int type) {
   try {
     switch (type) {
       case IScalarParameterDefn.TYPE_BOOLEAN:
         this.value = DataTypeUtil.toBoolean(value);
         break;
       case IScalarParameterDefn.TYPE_DATE_TIME:
         this.value = DataTypeUtil.toDate(value);
         break;
       case IScalarParameterDefn.TYPE_DECIMAL:
         this.value = DataTypeUtil.toBigDecimal(value);
         break;
       case IScalarParameterDefn.TYPE_FLOAT:
         this.value = DataTypeUtil.toDouble(value);
         break;
       case IScalarParameterDefn.TYPE_INTEGER:
         this.value = DataTypeUtil.toInteger(value);
         break;
       case IScalarParameterDefn.TYPE_DATE:
         this.value = DataTypeUtil.toSqlDate(value);
         break;
       case IScalarParameterDefn.TYPE_TIME:
         this.value = DataTypeUtil.toSqlTime(value);
         break;
       case IScalarParameterDefn.TYPE_STRING:
       default:
         this.value = DataTypeUtil.toString(value);
         break;
     }
   } catch (BirtException e) {
     log.log(Level.SEVERE, e.getLocalizedMessage(), e);
     this.value = null;
   }
 }
Ejemplo n.º 2
0
 /*
  * @see org.eclipse.birt.data.engine.api.IResultIterator#getBigDecimal(java.lang.String)
  */
 public BigDecimal getBigDecimal(String name) throws BirtException {
   return DataTypeUtil.toBigDecimal(getValue(name));
 }