1111/**
1212 * Represents optional arguments of TS.INCRBY or TS.DECRBY commands.
1313 */
14- public class TSIncrOrDecrByParams implements IParams {
14+ class TSArithByParams < T extends TSArithByParams <?>> implements IParams {
1515
1616 private Long timestamp ;
1717 private Long retentionPeriod ;
@@ -25,51 +25,39 @@ public class TSIncrOrDecrByParams implements IParams {
2525
2626 private Map <String , String > labels ;
2727
28- public TSIncrOrDecrByParams () {
28+ TSArithByParams () {
2929 }
3030
31- public static TSIncrOrDecrByParams params () {
32- return new TSIncrOrDecrByParams ();
33- }
34-
35- public static TSIncrOrDecrByParams incrByParams () {
36- return new TSIncrOrDecrByParams ();
37- }
38-
39- public static TSIncrOrDecrByParams decrByParams () {
40- return new TSIncrOrDecrByParams ();
41- }
42-
43- public TSIncrOrDecrByParams timestamp (long timestamp ) {
31+ public T timestamp (long timestamp ) {
4432 this .timestamp = timestamp ;
45- return this ;
33+ return ( T ) this ;
4634 }
4735
48- public TSIncrOrDecrByParams retention (long retentionPeriod ) {
36+ public T retention (long retentionPeriod ) {
4937 this .retentionPeriod = retentionPeriod ;
50- return this ;
38+ return ( T ) this ;
5139 }
5240
53- public TSIncrOrDecrByParams encoding (EncodingFormat encoding ) {
41+ public T encoding (EncodingFormat encoding ) {
5442 this .encoding = encoding ;
55- return this ;
43+ return ( T ) this ;
5644 }
5745
58- public TSIncrOrDecrByParams chunkSize (long chunkSize ) {
46+ public T chunkSize (long chunkSize ) {
5947 this .chunkSize = chunkSize ;
60- return this ;
48+ return ( T ) this ;
6149 }
6250
63- public TSIncrOrDecrByParams duplicatePolicy (DuplicatePolicy duplicatePolicy ) {
51+ public T duplicatePolicy (DuplicatePolicy duplicatePolicy ) {
6452 this .duplicatePolicy = duplicatePolicy ;
65- return this ;
53+ return ( T ) this ;
6654 }
6755
68- public TSIncrOrDecrByParams ignore (long maxTimediff , double maxValDiff ) {
56+ public T ignore (long maxTimediff , double maxValDiff ) {
6957 this .ignore = true ;
7058 this .ignoreMaxTimediff = maxTimediff ;
7159 this .ignoreMaxValDiff = maxValDiff ;
72- return this ;
60+ return ( T ) this ;
7361 }
7462
7563 /**
@@ -78,9 +66,9 @@ public TSIncrOrDecrByParams ignore(long maxTimediff, double maxValDiff) {
7866 * @param labels label-value pairs
7967 * @return the object itself
8068 */
81- public TSIncrOrDecrByParams labels (Map <String , String > labels ) {
69+ public T labels (Map <String , String > labels ) {
8270 this .labels = labels ;
83- return this ;
71+ return ( T ) this ;
8472 }
8573
8674 /**
@@ -89,12 +77,12 @@ public TSIncrOrDecrByParams labels(Map<String, String> labels) {
8977 * @param value
9078 * @return the object itself
9179 */
92- public TSIncrOrDecrByParams label (String label , String value ) {
80+ public T label (String label , String value ) {
9381 if (this .labels == null ) {
9482 this .labels = new LinkedHashMap <>();
9583 }
9684 this .labels .put (label , value );
97- return this ;
85+ return ( T ) this ;
9886 }
9987
10088 @ Override
0 commit comments