From 07c9529c149bd2d598da73e647742435a9c230bc Mon Sep 17 00:00:00 2001 From: Ashwin Giridharan Date: Tue, 28 Apr 2020 15:58:50 -0700 Subject: [PATCH] doc comments --- .../kinesis/common/HashKeyRangeForLease.java | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/amazon-kinesis-client/src/main/java/software/amazon/kinesis/common/HashKeyRangeForLease.java b/amazon-kinesis-client/src/main/java/software/amazon/kinesis/common/HashKeyRangeForLease.java index 1d4529ff..2d45b130 100644 --- a/amazon-kinesis-client/src/main/java/software/amazon/kinesis/common/HashKeyRangeForLease.java +++ b/amazon-kinesis-client/src/main/java/software/amazon/kinesis/common/HashKeyRangeForLease.java @@ -23,6 +23,9 @@ import software.amazon.awssdk.services.kinesis.model.HashKeyRange; @Data @Accessors(fluent = true) +/** + * Lease POJO to hold the starting hashkey range and ending hashkey range of kinesis shards. + */ public class HashKeyRangeForLease { private static final String DELIM = ":"; @@ -30,6 +33,10 @@ public class HashKeyRangeForLease { private final String startingHashKey; private final String endingHashKey; + /** + * Serialize the HashKeyRangeForLease for persisting in external storage + * @return Serialized string + */ public String serialize() { return Joiner.on(DELIM).join(startingHashKey, endingHashKey); } @@ -39,6 +46,11 @@ public class HashKeyRangeForLease { return serialize(); } + /** + * Deserialize from serialized hashKeyRange string from external storage. + * @param hashKeyRange + * @return HashKeyRangeForLease + */ public static HashKeyRangeForLease deserialize(String hashKeyRange) { final String[] hashKeyTokens = hashKeyRange.split(DELIM); Validate.isTrue(hashKeyTokens.length == 2, "HashKeyRange should have exactly two tokens"); @@ -48,6 +60,11 @@ public class HashKeyRangeForLease { return new HashKeyRangeForLease(hashKeyTokens[0], hashKeyTokens[1]); } + /** + * Construct HashKeyRangeForLease from Kinesis HashKeyRange + * @param hashKeyRange + * @return HashKeyRangeForLease + */ public static HashKeyRangeForLease fromHashKeyRange(HashKeyRange hashKeyRange) { return new HashKeyRangeForLease(hashKeyRange.startingHashKey(), hashKeyRange.endingHashKey()); }