public class CommandWrapper<K,V,T> extends Object implements RedisCommand<K,V,T>, CompleteableCommand<T>, DecoratedCommand<K,V,T>
| Modifier and Type | Field and Description |
|---|---|
protected RedisCommand<K,V,T> |
command |
| Constructor and Description |
|---|
CommandWrapper(RedisCommand<K,V,T> command) |
| Modifier and Type | Method and Description |
|---|---|
void |
cancel()
Attempts to cancel execution of this command.
|
void |
complete()
Complete a command.
|
boolean |
completeExceptionally(Throwable throwable)
Complete this command by attaching the given
exception. |
protected void |
doOnComplete()
Callback method called after successful completion and before notifying downstream consumers.
|
protected void |
doOnError(Throwable throwable)
Callback method called after error completion and before notifying downstream consumers.
|
void |
encode(ByteBuf buf)
Encode the command.
|
boolean |
equals(Object o) |
CommandArgs<K,V> |
getArgs() |
RedisCommand<K,V,T> |
getDelegate()
The underlying command.
|
CommandOutput<K,V,T> |
getOutput()
The command output.
|
ProtocolKeyword |
getType() |
int |
hashCode() |
boolean |
isCancelled()
Returns
true if this task was cancelled before it completed normally. |
boolean |
isDone()
Returns
true if this task completed. |
void |
onComplete(BiConsumer<? super T,Throwable> action)
Register a command callback for command completion that notifies the callback with the command result or the failure
resulting from command completion.
|
void |
onComplete(Consumer<? super T> action)
Register a command callback for successive command completion that notifies the callback with the command result.
|
void |
setOutput(CommandOutput<K,V,T> output)
Set a new output.
|
String |
toString() |
static <K,V,T> RedisCommand<K,V,T> |
unwrap(RedisCommand<K,V,T> wrapped)
Unwrap a wrapped command.
|
static <R,K,V,T> R |
unwrap(RedisCommand<K,V,T> wrapped,
Class<R> iface)
Returns an object that implements the given interface to allow access to non-standard methods, or standard methods not
exposed by the proxy.
|
protected final RedisCommand<K,V,T> command
public CommandWrapper(RedisCommand<K,V,T> command)
public CommandOutput<K,V,T> getOutput()
RedisCommandgetOutput in interface RedisCommand<K,V,T>public void complete()
RedisCommandcomplete in interface RedisCommand<K,V,T>protected void doOnComplete()
public void cancel()
RedisCommandcancel in interface RedisCommand<K,V,T>public boolean completeExceptionally(Throwable throwable)
RedisCommandexception.completeExceptionally in interface RedisCommand<K,V,T>throwable - the exception.true if this invocation caused this CompletableFuture to transition to a completed state, else
false.protected void doOnError(Throwable throwable)
throwable - public CommandArgs<K,V> getArgs()
getArgs in interface RedisCommand<K,V,T>public ProtocolKeyword getType()
getType in interface RedisCommand<K,V,T>SADD, HMSET, QUIT.public void encode(ByteBuf buf)
RedisCommandencode in interface RedisCommand<K,V,T>buf - byte buffer to operate on.public boolean isCancelled()
RedisCommandtrue if this task was cancelled before it completed normally.isCancelled in interface RedisCommand<K,V,T>true if the command was cancelled before it completed normally.public void setOutput(CommandOutput<K,V,T> output)
RedisCommandsetOutput in interface RedisCommand<K,V,T>output - the new command output.public void onComplete(Consumer<? super T> action)
CompleteableCommandonComplete in interface CompleteableCommand<T>action - must not be null.public void onComplete(BiConsumer<? super T,Throwable> action)
CompleteableCommandonComplete in interface CompleteableCommand<T>action - must not be null.public boolean isDone()
RedisCommandtrue if this task completed.
Completion may be due to normal termination, an exception, or cancellation. In all of these cases, this method will
return true.isDone in interface RedisCommand<K,V,T>true if this task completed.public RedisCommand<K,V,T> getDelegate()
DecoratedCommandgetDelegate in interface DecoratedCommand<K,V,T>null.public static <K,V,T> RedisCommand<K,V,T> unwrap(RedisCommand<K,V,T> wrapped)
wrapped - public static <R,K,V,T> R unwrap(RedisCommand<K,V,T> wrapped, Class<R> iface)
unwrap recursively on the wrapped object or a
proxy for that result. If the receiver is not a wrapper and does not implement the interface, then an null is
returned.wrapped - iface - A Class defining an interface that the result must implement.null.Copyright © 2021 lettuce.io. All rights reserved.