I
- input typeO
- output type@Singleton public class HttpFunctionExecutor<I,O> extends java.lang.Object implements FunctionInvoker<I,O>, java.io.Closeable, FunctionInvokerChooser
FunctionExecutor
that uses a HttpClient
to execute a remote function definition.Constructor and Description |
---|
HttpFunctionExecutor(RxHttpClient httpClient)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
<I1,O2> java.util.Optional<FunctionInvoker<I1,O2>> |
choose(FunctionDefinition definition)
Chooses a
FunctionInvoker . |
void |
close() |
O |
invoke(FunctionDefinition definition,
I input,
Argument<O> outputType)
Invoke the given function definition for the given input and expected response type.
|
public HttpFunctionExecutor(RxHttpClient httpClient)
httpClient
- The HTTP clientpublic O invoke(FunctionDefinition definition, I input, Argument<O> outputType)
FunctionInvoker
invoke
in interface FunctionInvoker<I,O>
definition
- The definitioninput
- The inputoutputType
- The response typepublic <I1,O2> java.util.Optional<FunctionInvoker<I1,O2>> choose(FunctionDefinition definition)
FunctionInvokerChooser
FunctionInvoker
.choose
in interface FunctionInvokerChooser
I1
- input typeO2
- output typedefinition
- The definitionOptional
instance of FunctionInvoker
@PreDestroy public void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
java.io.IOException