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 TTL(new ArgumentListTypeSignature(IntegerValue.class), "TTL"),
36 IN_MEMORY(new ArgumentListTypeSignature(BooleanValue.class), "IN_MEMORY"),
37 BLOCK_SIZE(new ArgumentListTypeSignature(IntegerValue.class), "BLOCK_SIZE"),
38 BLOCK_CACHE_ENABLED(new ArgumentListTypeSignature(BooleanValue.class), "BLOCK_CACHE_ENABLED"),
39 BLOOMFILTER_TYPE(new ArgumentListTypeSignature(), "BLOOMFILTER_TYPE"),
40 COMPRESSION_TYPE(new ArgumentListTypeSignature(), "COMPRESSION_TYPE");
41
42 private final ArgumentListTypeSignature typeSignature;
43 private final String description;
44
45 Type(final ArgumentListTypeSignature typeSignature, final String description) {
46 this.typeSignature = typeSignature;
47 this.description = description;
48 }
49
50 public ArgumentListTypeSignature getTypeSignature() {
51 return this.typeSignature;
52 }
53
54 public String getDescription() {
55 return this.description;
56 }
57 }
58
59 public FamilyProperty(final String text, final GenericValue... arg0) {
60 super(FamilyProperty.Type.valueOf(text.toUpperCase()), arg0);
61 }
62
63 public FamilyProperty(final Type type, final GenericValue... exprs) {
64 super(type, exprs);
65 }
66
67 public Type getEnumType() {
68 return (Type)this.getPropertyType();
69 }
70
71 public String asString() {
72 return this.getPropertyType().getDescription() + ": " + this.getGenericValue(0).asString();
73 }
74 }