16
16
package org .springframework .data .redis .connection ;
17
17
18
18
import java .util .ArrayList ;
19
+ import java .util .Arrays ;
19
20
import java .util .Collections ;
20
21
import java .util .Iterator ;
21
22
import java .util .List ;
29
30
*
30
31
* @author Christoph Strobl
31
32
* @author Qiang Lee
33
+ * @author Yanam
32
34
* @since 2.1
33
35
*/
34
36
public class BitFieldSubCommands implements Iterable <BitFieldSubCommand > {
@@ -56,6 +58,15 @@ public static BitFieldSubCommands create() {
56
58
return new BitFieldSubCommands (Collections .emptyList ());
57
59
}
58
60
61
+ /**
62
+ * Creates a new {@link BitFieldSubCommands} with Multiple BitFieldSubCommand.
63
+ *
64
+ * @return
65
+ */
66
+ public static BitFieldSubCommands create (BitFieldSubCommand ... subCommands ) {
67
+ return new BitFieldSubCommands (Arrays .asList (subCommands ));
68
+ }
69
+
59
70
/**
60
71
* Obtain a new {@link BitFieldGetBuilder} for creating and adding a {@link BitFieldGet} sub command.
61
72
*
@@ -533,6 +544,21 @@ public static class BitFieldSet extends AbstractBitFieldSubCommand {
533
544
534
545
private long value ;
535
546
547
+ /**
548
+ * Creates a new {@link BitFieldSet}.
549
+ * @param type must not be {@literal null}.
550
+ * @param offset must not be {@literal null}.
551
+ * @param value must not be {@literal null}.
552
+ * @return
553
+ */
554
+ public static BitFieldSet create (BitFieldType type ,Offset offset ,long value ){
555
+ BitFieldSet instance = new BitFieldSet ();
556
+ instance .type = type ;
557
+ instance .offset = offset ;
558
+ instance .value = value ;
559
+ return instance ;
560
+ }
561
+
536
562
/*
537
563
* (non-Javadoc)
538
564
* @see org.springframework.data.redis.connection.StringRedisConnection.BitFieldSubCommand#getCommand()
@@ -561,6 +587,19 @@ public long getValue() {
561
587
*/
562
588
public static class BitFieldGet extends AbstractBitFieldSubCommand {
563
589
590
+ /**
591
+ * Creates a new {@link BitFieldGet}.
592
+ * @param type must not be {@literal null}.
593
+ * @param offset must not be {@literal null}.
594
+ * @return
595
+ */
596
+ public static BitFieldGet create (BitFieldType type ,Offset offset ){
597
+ BitFieldGet instance = new BitFieldGet ();
598
+ instance .type = type ;
599
+ instance .offset = offset ;
600
+ return instance ;
601
+ }
602
+
564
603
/*
565
604
* (non-Javadoc)
566
605
* @see org.springframework.data.redis.connection.StringRedisConnection.BitFieldSubCommand#getCommand()
@@ -583,6 +622,38 @@ public static class BitFieldIncrBy extends AbstractBitFieldSubCommand {
583
622
private long value ;
584
623
private @ Nullable Overflow overflow ;
585
624
625
+ /**
626
+ * Creates a new {@link BitFieldIncrBy}.
627
+ * @param type must not be {@literal null}.
628
+ * @param offset must not be {@literal null}.
629
+ * @param value must not be {@literal null}.
630
+ * @return
631
+ */
632
+ public static BitFieldIncrBy create (BitFieldType type ,Offset offset ,long value ){
633
+ BitFieldIncrBy instance = new BitFieldIncrBy ();
634
+ instance .type = type ;
635
+ instance .offset = offset ;
636
+ instance .value = value ;
637
+ return instance ;
638
+ }
639
+
640
+ /**
641
+ * Creates a new {@link BitFieldIncrBy}.
642
+ * @param type must not be {@literal null}.
643
+ * @param offset must not be {@literal null}.
644
+ * @param value must not be {@literal null}.
645
+ * @param overflow Can be {@literal null} to use redis defaults.
646
+ * @return
647
+ */
648
+ public static BitFieldIncrBy create (BitFieldType type ,Offset offset ,long value ,Overflow overflow ){
649
+ BitFieldIncrBy instance = new BitFieldIncrBy ();
650
+ instance .type = type ;
651
+ instance .offset = offset ;
652
+ instance .value = value ;
653
+ instance .overflow = overflow ;
654
+ return instance ;
655
+ }
656
+
586
657
/*
587
658
* (non-Javadoc)
588
659
* @see org.springframework.data.redis.connection.StringRedisConnection.BitFieldSubCommand#getCommand()
0 commit comments