java.lang.Object
io.lettuce.core.BitFieldArgs
- All Implemented Interfaces:
CompositeArgument
public class BitFieldArgs extends Object implements CompositeArgument
Argument list builder for the Redis BITFIELD command.
BitFieldArgs is a mutable object and instances should be used only once to avoid shared mutable state.
- Since:
- 4.2
- Author:
- Mark Paluch, Ian Pojman
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classBitFieldArgs.BitFieldTypeRepresents a bit field type with details about signed/unsigned and the number of bits.static classBitFieldArgs.BuilderBuilder entry points forBitFieldArgs.static classBitFieldArgs.OffsetRepresents a bit field offset.static classBitFieldArgs.OverflowTypeRepresents the overflow types for theOVERFLOWsubcommand argument. -
Constructor Summary
Constructors Constructor Description BitFieldArgs()Creates a newBitFieldArgsinstance. -
Method Summary
Modifier and Type Method Description <K, V> voidbuild(CommandArgs<K,V> args)Build command arguments and contribute arguments toCommandArgs.BitFieldArgsget()Adds a newGETsubcommand using offset0and the field type of the previous command.BitFieldArgsget(int offset)Adds a newGETsubcommand using the field type of the previous command.BitFieldArgsget(BitFieldArgs.BitFieldType bitFieldType)Adds a newGETsubcommand using offset0.BitFieldArgsget(BitFieldArgs.BitFieldType bitFieldType, int offset)Adds a newGETsubcommand.BitFieldArgsget(BitFieldArgs.BitFieldType bitFieldType, BitFieldArgs.Offset offset)Adds a newGETsubcommand.BitFieldArgsincrBy(int offset, long value)Adds a newINCRBYsubcommand using the field type of the previous command.BitFieldArgsincrBy(long value)Adds a newINCRBYsubcommand using offset0and the field type of the previous command.BitFieldArgsincrBy(BitFieldArgs.BitFieldType bitFieldType, int offset, long value)Adds a newINCRBYsubcommand.BitFieldArgsincrBy(BitFieldArgs.BitFieldType bitFieldType, long value)Adds a newINCRBYsubcommand using offset0.BitFieldArgsincrBy(BitFieldArgs.BitFieldType bitFieldType, BitFieldArgs.Offset offset, long value)Adds a newINCRBYsubcommand.static BitFieldArgs.Offsetoffset(int offset)Creates a newBitFieldArgs.Offsetfor the givenoffset.BitFieldArgsoverflow(BitFieldArgs.OverflowType overflowType)Adds a newOVERFLOWsubcommand.BitFieldArgsset(int offset, long value)Adds a newSETsubcommand using the field type of the previous command.BitFieldArgsset(long value)Adds a newSETsubcommand using offset0and the field type of the previous command.BitFieldArgsset(BitFieldArgs.BitFieldType bitFieldType, int offset, long value)Adds a newSETsubcommand.BitFieldArgsset(BitFieldArgs.BitFieldType bitFieldType, long value)Adds a newSETsubcommand using offset0.BitFieldArgsset(BitFieldArgs.BitFieldType bitFieldType, BitFieldArgs.Offset offset, long value)Adds a newSETsubcommand.static BitFieldArgs.BitFieldTypesigned(int bits)Creates a new signedBitFieldArgs.BitFieldTypefor the given number ofbits.static BitFieldArgs.OffsettypeWidthBasedOffset(int offset)Creates a newBitFieldArgs.Offsetfor the givenoffsetthat is multiplied by the integer type width used in the sub command.static BitFieldArgs.BitFieldTypeunsigned(int bits)Creates a new unsignedBitFieldArgs.BitFieldTypefor the given number ofbits.
-
Constructor Details
-
BitFieldArgs
public BitFieldArgs()Creates a newBitFieldArgsinstance.
-
-
Method Details
-
signed
Creates a new signedBitFieldArgs.BitFieldTypefor the given number ofbits. Redis allows up to64bits for unsigned integers.- Parameters:
bits- number of bits to define the integer type width.- Returns:
- the
BitFieldArgs.BitFieldType.
-
unsigned
Creates a new unsignedBitFieldArgs.BitFieldTypefor the given number ofbits. Redis allows up to63bits for unsigned integers.- Parameters:
bits- number of bits to define the integer type width.- Returns:
- the
BitFieldArgs.BitFieldType.
-
offset
Creates a newBitFieldArgs.Offsetfor the givenoffset.- Parameters:
offset- zero-based offset.- Returns:
- the
BitFieldArgs.Offset. - Since:
- 4.3
-
typeWidthBasedOffset
Creates a newBitFieldArgs.Offsetfor the givenoffsetthat is multiplied by the integer type width used in the sub command.- Parameters:
offset- offset to be multiplied by the integer type width.- Returns:
- the
BitFieldArgs.Offset. - Since:
- 4.3
-
get
Adds a newGETsubcommand using offset0and the field type of the previous command.- Returns:
- a new
GETsubcommand for the givenbitFieldTypeandoffset. - Throws:
IllegalStateException- if no previous field type was found
-
get
Adds a newGETsubcommand using offset0.- Parameters:
bitFieldType- the bit field type, must not benull.- Returns:
- a new
GETsubcommand for the givenbitFieldTypeandoffset.
-
get
Adds a newGETsubcommand.- Parameters:
bitFieldType- the bit field type, must not benull.offset- bitfield offset- Returns:
- a new
GETsubcommand for the givenbitFieldTypeandoffset.
-
get
Adds a newGETsubcommand.- Parameters:
bitFieldType- the bit field type, must not benull.offset- bitfield offset- Returns:
- a new
GETsubcommand for the givenbitFieldTypeandoffset. - Since:
- 4.3
-
get
Adds a newGETsubcommand using the field type of the previous command.- Parameters:
offset- bitfield offset- Returns:
- a new
GETsubcommand for the givenbitFieldTypeandoffset. - Throws:
IllegalStateException- if no previous field type was found
-
set
Adds a newSETsubcommand using offset0and the field type of the previous command.- Parameters:
value- the value- Returns:
- a new
SETsubcommand for the givenbitFieldType,offsetandvalue. - Throws:
IllegalStateException- if no previous field type was found
-
set
Adds a newSETsubcommand using offset0.- Parameters:
bitFieldType- the bit field type, must not benull.value- the value- Returns:
- a new
SETsubcommand for the givenbitFieldType,offsetandvalue.
-
set
Adds a newSETsubcommand using the field type of the previous command.- Parameters:
offset- bitfield offsetvalue- the value- Returns:
- a new
SETsubcommand for the givenbitFieldType,offsetandvalue. - Throws:
IllegalStateException- if no previous field type was found
-
set
Adds a newSETsubcommand.- Parameters:
bitFieldType- the bit field type, must not benull.offset- bitfield offsetvalue- the value- Returns:
- a new
SETsubcommand for the givenbitFieldType,offsetandvalue.
-
set
public BitFieldArgs set(BitFieldArgs.BitFieldType bitFieldType, BitFieldArgs.Offset offset, long value)Adds a newSETsubcommand.- Parameters:
bitFieldType- the bit field type, must not benull.offset- bitfield offset, must not benull.value- the value- Returns:
- a new
SETsubcommand for the givenbitFieldType,offsetandvalue. - Since:
- 4.3
-
incrBy
Adds a newINCRBYsubcommand using offset0and the field type of the previous command.- Parameters:
value- the value- Returns:
- a new
INCRBYsubcommand for the givenbitFieldType,offsetandvalue. - Throws:
IllegalStateException- if no previous field type was found
-
incrBy
Adds a newINCRBYsubcommand using offset0.- Parameters:
bitFieldType- the bit field type, must not benull.value- the value- Returns:
- a new
INCRBYsubcommand for the givenbitFieldType,offsetandvalue.
-
incrBy
Adds a newINCRBYsubcommand using the field type of the previous command.- Parameters:
offset- bitfield offsetvalue- the value- Returns:
- a new
INCRBYsubcommand for the givenbitFieldType,offsetandvalue. - Throws:
IllegalStateException- if no previous field type was found
-
incrBy
Adds a newINCRBYsubcommand.- Parameters:
bitFieldType- the bit field type, must not benull.offset- bitfield offsetvalue- the value- Returns:
- a new
INCRBYsubcommand for the givenbitFieldType,offsetandvalue.
-
incrBy
public BitFieldArgs incrBy(BitFieldArgs.BitFieldType bitFieldType, BitFieldArgs.Offset offset, long value)Adds a newINCRBYsubcommand.- Parameters:
bitFieldType- the bit field type, must not benull.offset- bitfield offset, must not benull.value- the value- Returns:
- a new
INCRBYsubcommand for the givenbitFieldType,offsetandvalue. - Since:
- 4.3
-
overflow
Adds a newOVERFLOWsubcommand.- Parameters:
overflowType- type of overflow, must not benull.- Returns:
- a new
OVERFLOWsubcommand for the givenoverflowType.
-
build
Description copied from interface:CompositeArgumentBuild command arguments and contribute arguments toCommandArgs.Implementing classes are required to implement this method. Depending on the command nature and configured arguments, this method may contribute arguments but is not required to add arguments if none are specified.
- Specified by:
buildin interfaceCompositeArgument- Type Parameters:
K- Key type.V- Value type.- Parameters:
args- the command arguments, must not benull.
-