View Javadoc

1   /*
2    * Copyright (c) 2010.  The Apache Software Foundation
3    *
4    * Licensed to the Apache Software Foundation (ASF) under one
5    * or more contributor license agreements.  See the NOTICE file
6    * distributed with this work for additional information
7    * regarding copyright ownership.  The ASF licenses this file
8    * to you under the Apache License, Version 2.0 (the
9    * "License"); you may not use this file except in compliance
10   * with the License.  You may obtain a copy of the License at
11   *
12   *     http://www.apache.org/licenses/LICENSE-2.0
13   *
14   * Unless required by applicable law or agreed to in writing, software
15   * distributed under the License is distributed on an "AS IS" BASIS,
16   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17   * See the License for the specific language governing permissions and
18   * limitations under the License.
19   */
20  
21  package org.apache.hadoop.hbase.hbql.statement.args;
22  
23  import org.apache.expreval.expr.ArgumentListTypeSignature;
24  import org.apache.expreval.expr.ExpressionProperty;
25  import org.apache.expreval.expr.PropertyType;
26  import org.apache.expreval.expr.node.DateValue;
27  import org.apache.expreval.expr.node.GenericValue;
28  import org.apache.expreval.expr.node.IntegerValue;
29  import org.apache.expreval.expr.node.StringValue;
30  
31  public abstract class SelectStatementArgs extends ExpressionProperty {
32  
33      public static enum ArgType implements PropertyType {
34  
35          NOARGSKEY(new ArgumentListTypeSignature(), ""),
36          SINGLEKEY(new ArgumentListTypeSignature(StringValue.class), ""),
37          KEYRANGE(new ArgumentListTypeSignature(StringValue.class, StringValue.class), ""),
38          TIMESTAMPRANGE(new ArgumentListTypeSignature(DateValue.class, DateValue.class), "TIMESTAMP"),
39          LIMIT(new ArgumentListTypeSignature(IntegerValue.class), "LIMIT"),
40          SCANNERCACHE(new ArgumentListTypeSignature(IntegerValue.class), "SCANNER_CACHE"),
41          VERSION(new ArgumentListTypeSignature(IntegerValue.class), "VERSION"),
42          WIDTH(new ArgumentListTypeSignature(IntegerValue.class), "WIDTH");
43  
44          private final ArgumentListTypeSignature typeSignature;
45          private final String description;
46  
47          ArgType(final ArgumentListTypeSignature typeSignature, final String description) {
48              this.typeSignature = typeSignature;
49              this.description = description;
50          }
51  
52          public ArgumentListTypeSignature getTypeSignature() {
53              return typeSignature;
54          }
55  
56          public String getDescription() {
57              return this.description;
58          }
59      }
60  
61      protected SelectStatementArgs(final ArgType argType, final GenericValue... exprs) {
62          super(argType, exprs);
63      }
64  }