1 15 package org.josql.expressions; 16 17 import org.josql.Query; 18 import org.josql.QueryExecutionException; 19 import org.josql.QueryParseException; 20 21 import org.josql.internal.Utilities; 22 23 31 public class AliasedExpression extends Expression 32 { 33 34 private String alias = null; 35 protected Expression exp = null; 36 private boolean fixedResult = false; 37 38 45 public boolean hasFixedResult (Query q) 46 { 47 48 return this.fixedResult; 49 50 } 51 52 60 public Class getExpectedReturnType (Query q) 61 throws QueryParseException 62 { 63 64 return this.exp.getExpectedReturnType (q); 65 66 } 67 68 76 public void init (Query q) 77 throws QueryParseException 78 { 79 80 this.exp.init (q); 81 82 this.fixedResult = this.exp.hasFixedResult (q); 83 84 } 85 86 91 public String getAlias () 92 { 93 94 return this.alias; 95 96 } 97 98 public void setAlias (String a) 99 { 100 101 this.alias = Utilities.stripQuotes (a); 102 103 } 104 105 110 public Expression getExpression () 111 { 112 113 return this.exp; 114 115 } 116 117 public void setExpression (Expression exp) 118 { 119 120 this.exp = exp; 121 122 } 123 124 135 public boolean isTrue (Object o, 136 Query q) 137 throws QueryExecutionException 138 { 139 140 return this.exp.isTrue (o, 141 q); 142 143 } 144 145 154 public Object getValue (Object o, 155 Query q) 156 throws QueryExecutionException 157 { 158 159 return this.exp.getValue (o, 160 q); 161 162 } 163 164 170 public String toString () 171 { 172 173 return this.exp.toString () + " AS " + this.alias; 174 175 } 176 177 } 178
| Popular Tags
|