1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
/*
* Copyright 2014 Jesse Morgan
*/
package com.p4square.grow.backend.dynamo;
/**
* DynamoKey represents a table, hash key, and range key tupl.
*/
public class DynamoKey {
private final String mTable;
private final String mHashKey;
private final String mRangeKey;
private final String mAttribute;
public static DynamoKey newKey(final String table, final String hashKey) {
return new DynamoKey(table, hashKey, null, null);
}
public static DynamoKey newRangeKey(final String table, final String hashKey,
final String rangeKey) {
return new DynamoKey(table, hashKey, rangeKey, null);
}
public static DynamoKey newAttributeKey(final String table, final String hashKey,
final String attribute) {
return new DynamoKey(table, hashKey, null, attribute);
}
public DynamoKey(final String table, final String hashKey, final String rangeKey,
final String attribute) {
mTable = table;
mHashKey = hashKey;
mRangeKey = rangeKey;
mAttribute = attribute;
}
public String getTable() {
return mTable;
}
public String getHashKey() {
return mHashKey;
}
public String getRangeKey() {
return mRangeKey;
}
public String getAttribute() {
return mAttribute;
}
}
|