1 package mobisnap.mobile_trx; 2 3 /*** 4 * Used to represent variables and constants internally 5 */ 6 public class MSQLTBoolean extends MSQLTVariable 7 { 8 public MSQLTBoolean( boolean constant, boolean notnull) { 9 super( constant, notnull); 10 } 11 12 /*** 13 * Sets the value of the given variable 14 */ 15 public void setValue( Object obj) throws Exception { 16 if( constant && value != null) 17 throw new mobisnap.MobisnapException( "Assigning value to constant"); 18 if( obj instanceof Boolean) 19 value = obj; 20 else if( obj instanceof SQLNull && ! notnull) 21 value = obj; 22 else if( obj instanceof String) { 23 if( ((String)obj).equalsIgnoreCase( "true")) 24 value = new Boolean( true); 25 if( ((String)obj).equalsIgnoreCase( "false")) 26 value = new Boolean( false); 27 throw new mobisnap.MobisnapException( "Invalid assgnment to boolean : " + obj.getClass().getName()); 28 } else 29 throw new mobisnap.MobisnapException( "Invalid assgnment to boolean : " + obj.getClass().getName()); 30 } 31 }

This page was automatically generated by Maven