public class ComplexOutput<K,V,T> extends CommandOutput<K,V,T>
CommandOutput
that is used in combination with a given ComplexDataParser
to produce
a domain object from the data extracted from the server. Since there already are implementations of the CommandOutput
interface for most simple types, this implementation is better suited to parse complex, often nested, data structures, for
example a map containing other maps, arrays or sets as values for one or more of its keys.
The implementation of the ComplexDataParser
is responsible for mapping the data from the result to meaningful
properties that the user of the LEttuce driver could then use in a statically typed manner.
ComplexDataParser
codec, error, output
Constructor and Description |
---|
ComplexOutput(RedisCodec<K,V> codec,
ComplexDataParser<T> parser)
Constructs a new instance of the
ComplexOutput |
Modifier and Type | Method and Description |
---|---|
void |
complete(int depth)
Mark the command output complete.
|
T |
get()
Get the command output.
|
void |
multiArray(int count)
Mark the beginning of a multi sequence (array).
|
void |
multiMap(int count)
Mark the beginning of a multi sequence (map).
|
void |
multiSet(int count)
Mark the beginning of a set.
|
void |
set(boolean value)
Update the command output with a boolean.
|
void |
set(ByteBuffer bytes)
Update the command output with a sequence of bytes, or
null . |
void |
set(double number)
Update the command output with a floating-point number.
|
void |
set(long integer)
Update the command output with a 64-bit signed integer.
|
void |
setSingle(ByteBuffer bytes)
Update the command output with a sequence of bytes, or
null representing a simple string. |
decodeAscii, getError, hasError, multi, multiPush, setBigNumber, setError, setError, toString
public ComplexOutput(RedisCodec<K,V> codec, ComplexDataParser<T> parser)
ComplexOutput
codec
- the RedisCodec
to be appliedpublic T get()
CommandOutput
get
in class CommandOutput<K,V,T>
public void set(long integer)
CommandOutput
CommandOutput
implementations must override this
method to decode number
(integer) response values.set
in class CommandOutput<K,V,T>
integer
- The command output.public void set(double number)
CommandOutput
CommandOutput
implementations must override this
method to decode double
response values.set
in class CommandOutput<K,V,T>
number
- The command output.public void set(boolean value)
CommandOutput
CommandOutput
implementations must override this method to
decode boolean
response values.set
in class CommandOutput<K,V,T>
value
- The command output.public void set(ByteBuffer bytes)
CommandOutput
null
. Concrete CommandOutput
implementations must
override this method to decode bulk
/bytes response values.set
in class CommandOutput<K,V,T>
bytes
- The command output, or null.public void setSingle(ByteBuffer bytes)
CommandOutput
null
representing a simple string. Concrete
CommandOutput
implementations must override this method to decode single
/bytes response values.setSingle
in class CommandOutput<K,V,T>
bytes
- The command output, or null.public void complete(int depth)
CommandOutput
complete
in class CommandOutput<K,V,T>
depth
- Remaining depth of output queue.public void multiSet(int count)
CommandOutput
multiSet
in class CommandOutput<K,V,T>
count
- expected number of elements in this multi sequence.public void multiArray(int count)
CommandOutput
multiArray
in class CommandOutput<K,V,T>
count
- expected number of elements in this multi sequence.public void multiMap(int count)
CommandOutput
multiMap
in class CommandOutput<K,V,T>
count
- expected number of elements in this multi sequence.Copyright © 2024 lettuce.io. All rights reserved.