1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 package org.apache.expreval.expr;
22
23 import org.apache.expreval.expr.node.GenericValue;
24 import org.apache.hadoop.hbase.hbql.client.HBqlException;
25
26 public abstract class ExpressionProperty extends MultipleExpressionContext {
27
28 private final PropertyType propertyType;
29
30 public ExpressionProperty(final PropertyType propertyType, final GenericValue... exprs) {
31 super(propertyType.getTypeSignature(), exprs);
32 this.propertyType = propertyType;
33 }
34
35
36 public ExpressionProperty(final ArgumentListTypeSignature argumentListTypeSignature, final GenericValue expr) {
37 super(argumentListTypeSignature, expr);
38 this.propertyType = null;
39 }
40
41 public PropertyType getPropertyType() {
42 return this.propertyType;
43 }
44
45 public boolean useResultData() {
46 return false;
47 }
48
49 public boolean allowColumns() {
50 return false;
51 }
52
53 public void validate() throws HBqlException {
54 this.validateTypes(this.allowColumns(), false);
55 }
56
57 public int getIntegerValue() throws HBqlException {
58 return ((Number)this.evaluateConstant(0, false)).intValue();
59 }
60
61 public boolean getBooleanValue() throws HBqlException {
62 return ((Boolean)this.evaluateConstant(0, false));
63 }
64 }