1616package org .springframework .data .redis .connection ;
1717
1818import java .util .ArrayList ;
19+ import java .util .Arrays ;
1920import java .util .Collections ;
2021import java .util .Iterator ;
2122import java .util .List ;
2930 *
3031 * @author Christoph Strobl
3132 * @author Qiang Lee
33+ * @author Yanam
3234 * @since 2.1
3335 */
3436public class BitFieldSubCommands implements Iterable <BitFieldSubCommand > {
@@ -56,6 +58,15 @@ public static BitFieldSubCommands create() {
5658 return new BitFieldSubCommands (Collections .emptyList ());
5759 }
5860
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+
5970 /**
6071 * Obtain a new {@link BitFieldGetBuilder} for creating and adding a {@link BitFieldGet} sub command.
6172 *
@@ -533,6 +544,21 @@ public static class BitFieldSet extends AbstractBitFieldSubCommand {
533544
534545 private long value ;
535546
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+
536562 /*
537563 * (non-Javadoc)
538564 * @see org.springframework.data.redis.connection.StringRedisConnection.BitFieldSubCommand#getCommand()
@@ -561,6 +587,19 @@ public long getValue() {
561587 */
562588 public static class BitFieldGet extends AbstractBitFieldSubCommand {
563589
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+
564603 /*
565604 * (non-Javadoc)
566605 * @see org.springframework.data.redis.connection.StringRedisConnection.BitFieldSubCommand#getCommand()
@@ -583,6 +622,38 @@ public static class BitFieldIncrBy extends AbstractBitFieldSubCommand {
583622 private long value ;
584623 private @ Nullable Overflow overflow ;
585624
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+
586657 /*
587658 * (non-Javadoc)
588659 * @see org.springframework.data.redis.connection.StringRedisConnection.BitFieldSubCommand#getCommand()
0 commit comments