1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package org.tikv.common.meta;
19
20 import com.fasterxml.jackson.annotation.JsonCreator;
21 import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
22 import com.fasterxml.jackson.annotation.JsonProperty;
23 import com.google.common.annotations.VisibleForTesting;
24 import com.google.common.collect.ImmutableList;
25 import java.io.Serializable;
26 import java.util.ArrayList;
27 import java.util.List;
28
29 @JsonIgnoreProperties(ignoreUnknown = true)
30 public class TiPartitionDef implements Serializable {
31 private final long id;
32 private final String name;
33 private final List<String> lessThan;
34 private final String comment;
35
36 @VisibleForTesting
37 @JsonCreator
38 public TiPartitionDef(
39 @JsonProperty("id") long id,
40 @JsonProperty("name") org.tikv.common.meta.CIStr name,
41 @JsonProperty("less_than") List<String> lessThan,
42 @JsonProperty("comment") String comment) {
43 this.id = id;
44 this.name = name.getL();
45 if (lessThan == null || lessThan.isEmpty()) {
46 this.lessThan = new ArrayList<>();
47 } else {
48 this.lessThan = ImmutableList.copyOf(lessThan);
49 }
50 this.comment = comment;
51 }
52
53 public long getId() {
54 return id;
55 }
56
57 public String getName() {
58 return name;
59 }
60
61 public List<String> getLessThan() {
62 return lessThan;
63 }
64 }