1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 package org.apache.hadoop.hbase.hbql.mapping;
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.BooleanValue;
27 import org.apache.expreval.expr.node.GenericValue;
28 import org.apache.expreval.expr.node.IntegerValue;
29
30 public class FamilyProperty extends ExpressionProperty {
31
32 public static enum Type implements PropertyType {
33
34 MAX_VERSIONS(new ArgumentListTypeSignature(IntegerValue.class), "MAX_VERSIONS"),
35 MAP_FILE_INDEX_INTERVAL(new ArgumentListTypeSignature(IntegerValue.class), "MAP_FILE_INDEX_INTERVAL"),
36 TTL(new ArgumentListTypeSignature(IntegerValue.class), "TTL"),
37 IN_MEMORY(new ArgumentListTypeSignature(BooleanValue.class), "IN_MEMORY"),
38 BLOCK_SIZE(new ArgumentListTypeSignature(IntegerValue.class), "BLOCK_SIZE"),
39 BLOCK_CACHE_ENABLED(new ArgumentListTypeSignature(BooleanValue.class), "BLOCK_CACHE_ENABLED"),
40 BLOOM_FILTER(new ArgumentListTypeSignature(BooleanValue.class), "BLOOM_FILTER"),
41 COMPRESSION_TYPE(new ArgumentListTypeSignature(), "COMPRESSION_TYPE");
42
43 private final ArgumentListTypeSignature typeSignature;
44 private final String description;
45
46 Type(final ArgumentListTypeSignature typeSignature, final String description) {
47 this.typeSignature = typeSignature;
48 this.description = description;
49 }
50
51 public ArgumentListTypeSignature getTypeSignature() {
52 return this.typeSignature;
53 }
54
55 public String getDescription() {
56 return this.description;
57 }
58 }
59
60 public FamilyProperty(final String text, final GenericValue... arg0) {
61 super(FamilyProperty.Type.valueOf(text.toUpperCase()), arg0);
62 }
63
64 public FamilyProperty(final Type type, final GenericValue... exprs) {
65 super(type, exprs);
66 }
67
68 public Type getEnumType() {
69 return (Type)this.getPropertyType();
70 }
71
72 public String asString() {
73 return this.getPropertyType().getDescription() + ": " + this.getGenericValue(0).asString();
74 }
75 }