-
Notifications
You must be signed in to change notification settings - Fork 133
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: add ProxyCommandSupportAdapter
- Loading branch information
Showing
1 changed file
with
95 additions
and
0 deletions.
There are no files selected for viewing
95 changes: 95 additions & 0 deletions
95
src/main/java/org/jetlinks/core/command/ProxyCommandSupportAdapter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
package org.jetlinks.core.command; | ||
|
||
import lombok.AllArgsConstructor; | ||
import org.jetlinks.core.metadata.FunctionMetadata; | ||
import reactor.core.publisher.Flux; | ||
import reactor.core.publisher.Mono; | ||
|
||
import javax.annotation.Nonnull; | ||
import java.util.Map; | ||
|
||
@AllArgsConstructor | ||
public class ProxyCommandSupportAdapter implements ProxyCommandSupport { | ||
private final CommandSupport target; | ||
|
||
@Override | ||
public CommandSupport getProxyTarget() { | ||
return target; | ||
} | ||
|
||
@Nonnull | ||
@Override | ||
public <R> R execute(@Nonnull Command<R> command) { | ||
return target.execute(command); | ||
} | ||
|
||
@Override | ||
public Flux<Object> executeToFlux(Command<?> command) { | ||
return target.executeToFlux(command); | ||
} | ||
|
||
@Override | ||
public Flux<Object> executeToFlux(String commandId, Map<String, Object> parameters) { | ||
return target.executeToFlux(commandId, parameters); | ||
} | ||
|
||
@Override | ||
public Flux<Object> executeToFlux(String commandId, Map<String, Object> parameters, Flux<Object> stream) { | ||
return target.executeToFlux(commandId, parameters, stream); | ||
} | ||
|
||
@Override | ||
public Mono<Boolean> commandIsSupported(Command<?> cmd) { | ||
return target.commandIsSupported(cmd); | ||
} | ||
|
||
@Override | ||
public Mono<Boolean> commandIsSupported(String commandId) { | ||
return target.commandIsSupported(commandId); | ||
} | ||
|
||
@Override | ||
public <R, C extends Command<R>> C createCommand(String commandId) { | ||
return target.createCommand(commandId); | ||
} | ||
|
||
@Override | ||
public <R, C extends Command<R>> Mono<C> createCommandAsync(String commandId) { | ||
return target.createCommandAsync(commandId); | ||
} | ||
|
||
@Override | ||
public Mono<Boolean> commandIsSupported(Class<? extends Command<?>> cmd) { | ||
return target.commandIsSupported(cmd); | ||
} | ||
|
||
@Override | ||
public Flux<FunctionMetadata> getCommandMetadata() { | ||
return target.getCommandMetadata(); | ||
} | ||
|
||
@Override | ||
public Mono<FunctionMetadata> getCommandMetadata(String commandId) { | ||
return target.getCommandMetadata(commandId); | ||
} | ||
|
||
@Override | ||
public Mono<Object> executeToMono(Command<?> command) { | ||
return target.executeToMono(command); | ||
} | ||
|
||
@Override | ||
public Mono<Object> executeToMono(String commandId, Map<String, Object> parameters) { | ||
return target.executeToMono(commandId, parameters); | ||
} | ||
|
||
@Override | ||
public boolean isWrapperFor(Class<?> type) { | ||
return ProxyCommandSupport.super.isWrapperFor(type); | ||
} | ||
|
||
@Override | ||
public <T> T unwrap(Class<T> type) { | ||
return ProxyCommandSupport.super.unwrap(type); | ||
} | ||
} |