Package io.lettuce.core.output
Class TransformingOutput<K,V,S,T>
- java.lang.Object
-
- io.lettuce.core.output.CommandOutput<K,V,T>
-
- io.lettuce.core.output.TransformingOutput<K,V,S,T>
-
public class TransformingOutput<K,V,S,T> extends CommandOutput<K,V,T>
Command output that can transform the output from an underlying command output by applying a mapping function.- Since:
- 6.3
- Author:
- Mark Paluch
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
TransformingOutput.TransformingAccessor
Accessor for the underlying output.
-
Field Summary
-
Fields inherited from class io.lettuce.core.output.CommandOutput
codec, error, output
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
complete(int depth)
Mark the command output complete.T
get()
Get the command output.String
getError()
Get the error that occurred.boolean
hasError()
Check if the command resulted in an error.void
multi(int count)
Mark the beginning of a multi sequence (array).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
multiPush(int count)
Mark the beginning of a multi sequence (push-array).void
multiSet(int count)
Mark the beginning of a set.void
set(boolean value)
Update the command output with a boolean.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
set(ByteBuffer bytes)
Update the command output with a sequence of bytes, ornull
.void
setBigNumber(ByteBuffer bytes)
Update the command output with a big number.void
setError(String error)
Set command output to an error message from the client.void
setError(ByteBuffer error)
Set command output to an error message from the server.void
setSingle(ByteBuffer bytes)
Update the command output with a sequence of bytes, ornull
representing a simple string.static <K,V,S,T>
CommandOutput<K,V,T>transform(CommandOutput<K,V,S> delegate, Function<TransformingOutput.TransformingAccessor,T> mappingFunction)
Create a new transforming output.-
Methods inherited from class io.lettuce.core.output.CommandOutput
decodeAscii, toString
-
-
-
-
Method Detail
-
transform
public static <K,V,S,T> CommandOutput<K,V,T> transform(CommandOutput<K,V,S> delegate, Function<TransformingOutput.TransformingAccessor,T> mappingFunction)
Create a new transforming output.
-
set
public void set(ByteBuffer bytes)
Description copied from class:CommandOutput
Update the command output with a sequence of bytes, ornull
. ConcreteCommandOutput
implementations must override this method to decodebulk
/bytes response values.- Overrides:
set
in classCommandOutput<K,V,T>
- Parameters:
bytes
- The command output, or null.
-
setSingle
public void setSingle(ByteBuffer bytes)
Description copied from class:CommandOutput
Update the command output with a sequence of bytes, ornull
representing a simple string. ConcreteCommandOutput
implementations must override this method to decodesingle
/bytes response values.- Overrides:
setSingle
in classCommandOutput<K,V,T>
- Parameters:
bytes
- The command output, or null.
-
setBigNumber
public void setBigNumber(ByteBuffer bytes)
Description copied from class:CommandOutput
Update the command output with a big number. ConcreteCommandOutput
implementations must override this method to decodebig number
response values.- Overrides:
setBigNumber
in classCommandOutput<K,V,T>
- Parameters:
bytes
- The command output, or null.
-
set
public void set(long integer)
Description copied from class:CommandOutput
Update the command output with a 64-bit signed integer. ConcreteCommandOutput
implementations must override this method to decodenumber
(integer) response values.- Overrides:
set
in classCommandOutput<K,V,T>
- Parameters:
integer
- The command output.
-
set
public void set(double number)
Description copied from class:CommandOutput
Update the command output with a floating-point number. ConcreteCommandOutput
implementations must override this method to decodedouble
response values.- Overrides:
set
in classCommandOutput<K,V,T>
- Parameters:
number
- The command output.
-
set
public void set(boolean value)
Description copied from class:CommandOutput
Update the command output with a boolean. ConcreteCommandOutput
implementations must override this method to decodeboolean
response values.- Overrides:
set
in classCommandOutput<K,V,T>
- Parameters:
value
- The command output.
-
setError
public void setError(ByteBuffer error)
Description copied from class:CommandOutput
Set command output to an error message from the server.- Overrides:
setError
in classCommandOutput<K,V,T>
- Parameters:
error
- Error message.
-
setError
public void setError(String error)
Description copied from class:CommandOutput
Set command output to an error message from the client.- Overrides:
setError
in classCommandOutput<K,V,T>
- Parameters:
error
- Error message.
-
hasError
public boolean hasError()
Description copied from class:CommandOutput
Check if the command resulted in an error.- Overrides:
hasError
in classCommandOutput<K,V,T>
- Returns:
- true if command resulted in an error.
-
getError
public String getError()
Description copied from class:CommandOutput
Get the error that occurred.- Overrides:
getError
in classCommandOutput<K,V,T>
- Returns:
- The error.
-
get
public T get()
Description copied from class:CommandOutput
Get the command output.- Overrides:
get
in classCommandOutput<K,V,T>
- Returns:
- The command output.
-
complete
public void complete(int depth)
Description copied from class:CommandOutput
Mark the command output complete.- Overrides:
complete
in classCommandOutput<K,V,T>
- Parameters:
depth
- Remaining depth of output queue.
-
multi
public void multi(int count)
Description copied from class:CommandOutput
Mark the beginning of a multi sequence (array).- Overrides:
multi
in classCommandOutput<K,V,T>
- Parameters:
count
- expected number of elements in this multi sequence.
-
multiArray
public void multiArray(int count)
Description copied from class:CommandOutput
Mark the beginning of a multi sequence (array).- Overrides:
multiArray
in classCommandOutput<K,V,T>
- Parameters:
count
- expected number of elements in this multi sequence.
-
multiPush
public void multiPush(int count)
Description copied from class:CommandOutput
Mark the beginning of a multi sequence (push-array).- Overrides:
multiPush
in classCommandOutput<K,V,T>
- Parameters:
count
- expected number of elements in this multi sequence.
-
multiMap
public void multiMap(int count)
Description copied from class:CommandOutput
Mark the beginning of a multi sequence (map).- Overrides:
multiMap
in classCommandOutput<K,V,T>
- Parameters:
count
- expected number of elements in this multi sequence.
-
multiSet
public void multiSet(int count)
Description copied from class:CommandOutput
Mark the beginning of a set.- Overrides:
multiSet
in classCommandOutput<K,V,T>
- Parameters:
count
- expected number of elements in this multi sequence.
-
-