1 15 package org.josql.expressions; 16 17 import org.josql.Query; 18 import org.josql.QueryExecutionException; 19 import org.josql.QueryParseException; 20 21 28 public class BooleanExpression extends ValueExpression 29 { 30 31 private Boolean value = null; 32 33 public BooleanExpression () 34 { 35 36 } 37 38 44 public boolean hasFixedResult (Query q) 45 { 46 47 return true; 48 49 } 50 51 57 public String toString () 58 { 59 60 if (this.isBracketed ()) 61 { 62 63 return "(" + this.value.toString () + ")"; 64 65 } 66 67 return this.value.toString (); 68 69 } 70 71 77 public Class getExpectedReturnType (Query q) 78 { 79 80 return Boolean.TYPE; 81 82 } 83 84 89 public void init (Query q) 90 { 91 92 94 } 95 96 public void setValue (Boolean b) 97 { 98 99 this.value = b; 100 101 } 102 103 110 public boolean isTrue (Object o, 111 Query q) 112 { 113 114 return this.value.booleanValue (); 115 116 } 117 118 125 public Object getValue (Object o, 126 Query q) 127 { 128 129 return this.value; 130 131 } 132 133 140 public Object evaluate (Object o, 141 Query q) 142 { 143 144 return this.value; 145 146 } 147 148 } 149 | Popular Tags |