1 package mobisnap.mobile_trx; 2 3 import java.math.*; 4 5 /*** 6 * Used to represent variables and constants internally 7 */ 8 public class MSQLTFloat extends MSQLTVariable 9 { 10 int precision; 11 12 public MSQLTFloat( boolean constant, boolean notnull, int precision) { 13 super( constant, notnull); 14 this.precision = precision; 15 } 16 17 /*** 18 * Sets the value of the given variable 19 */ 20 public void setValue( Object obj) throws Exception { 21 if( constant && value != null) 22 throw new mobisnap.MobisnapException( "Assigning value to constant"); 23 if( obj instanceof Integer) 24 value = new Double( ((Integer)obj).doubleValue()); 25 else if( obj instanceof Double) 26 value = obj; 27 else if( obj instanceof Float) 28 value = new Double( ((Float)obj).doubleValue()); 29 else if( obj instanceof BigDecimal) 30 value = new Double( ((BigDecimal)obj).doubleValue()); 31 else if( obj instanceof SQLNull && ! notnull) 32 value = obj; 33 else if( obj instanceof String) 34 value = new Double( (String)obj); 35 else 36 throw new mobisnap.MobisnapException( "Invalid assgnment to float : " + obj.getClass().getName()); 37 } 38 }

This page was automatically generated by Maven