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