1 15 package org.josql.expressions; 16 17 import org.josql.Query; 18 import org.josql.QueryExecutionException; 19 20 27 public class IsNullExpression extends BinaryExpression 28 { 29 30 private boolean not = false; 31 32 public boolean isNot () 33 { 34 35 return this.not; 36 37 } 38 39 public void setNot (boolean v) 40 { 41 42 this.not = v; 43 44 } 45 46 52 public String toString () 53 { 54 55 StringBuffer buf = new StringBuffer ("IS "); 56 57 if (this.not) 58 { 59 60 buf.append ("NOT "); 61 62 } 63 64 buf.append (this.left.toString ()); 65 66 if (this.isBracketed ()) 67 { 68 69 buf.insert (0, 70 "("); 71 buf.append (")"); 72 73 } 74 75 return buf.toString (); 76 77 } 78 79 89 public boolean isTrue (Object o, 90 Query q) 91 throws QueryExecutionException 92 { 93 94 o = this.left.getValue (o, 96 q); 97 98 if (o == null) 99 { 100 101 if (this.not) 102 { 103 104 return false; 105 106 } 107 108 return true; 109 110 } 111 112 if (this.not) 113 { 114 115 return true; 116 117 } 118 119 return false; 120 121 } 122 123 } 124 | Popular Tags |