Class StitchServiceClientImpl
- java.lang.Object
-
- com.mongodb.stitch.android.core.services.internal.StitchServiceClientImpl
-
- All Implemented Interfaces:
StitchServiceClient
public final class StitchServiceClientImpl extends Object implements StitchServiceClient
-
-
Constructor Summary
Constructors Constructor Description StitchServiceClientImpl(CoreStitchServiceClient proxy, TaskDispatcher dispatcher)
-
Method Summary
Modifier and Type Method Description Task<Void>
callFunction(String name, List<?> args)
Calls the specified Stitch service function.<ResultT> Task<ResultT>
callFunction(String name, List<?> args, Class<ResultT> resultClass)
Calls the specified Stitch service function, and decodes the response into an instance of the specified type.<ResultT> Task<ResultT>
callFunction(String name, List<?> args, Class<ResultT> resultClass, CodecRegistry codecRegistry)
Calls the specified Stitch service function, and decodes the response into an instance of the specified type.Task<Void>
callFunction(String name, List<?> args, Long requestTimeout)
Calls the specified Stitch service function.<ResultT> Task<ResultT>
callFunction(String name, List<?> args, Long requestTimeout, Class<ResultT> resultClass)
Calls the specified Stitch service function, and decodes the response into an instance of the specified type.<ResultT> Task<ResultT>
callFunction(String name, List<?> args, Long requestTimeout, Class<ResultT> resultClass, CodecRegistry codecRegistry)
Calls the specified Stitch service function, and decodes the response into an instance of the specified type.<ResultT> Task<ResultT>
callFunction(String name, List<?> args, Long requestTimeout, Decoder<ResultT> resultDecoder)
Calls the specified Stitch service function, and decodes the response into a value using the providedDecoder
.<ResultT> Task<ResultT>
callFunction(String name, List<?> args, Decoder<ResultT> resultDecoder)
Calls the specified Stitch service function, and decodes the response into a value using the providedDecoder
.CodecRegistry
getCodecRegistry()
Get the codec registry that will be used to decode responses when a codec registry.StitchServiceClient
withCodecRegistry(CodecRegistry codecRegistry)
Create a new StitchServiceClient instance with a different codec registry.
-
-
-
Constructor Detail
-
StitchServiceClientImpl
public StitchServiceClientImpl(CoreStitchServiceClient proxy, TaskDispatcher dispatcher)
-
-
Method Detail
-
callFunction
public Task<Void> callFunction(String name, List<?> args)
Description copied from interface:StitchServiceClient
Calls the specified Stitch service function.- Specified by:
callFunction
in interfaceStitchServiceClient
- Parameters:
name
- the name of the Stitch service function to call.args
- the arguments to pass to the function.- Returns:
- a
Task
that completes when the request completes.
-
callFunction
public <ResultT> Task<ResultT> callFunction(String name, List<?> args, Decoder<ResultT> resultDecoder)
Description copied from interface:StitchServiceClient
Calls the specified Stitch service function, and decodes the response into a value using the providedDecoder
.- Specified by:
callFunction
in interfaceStitchServiceClient
- Type Parameters:
ResultT
- the type into which the response will be decoded.- Parameters:
name
- the name of the Stitch service function to call.args
- the arguments to pass to the function.resultDecoder
- theDecoder
to use to decode the response into a value.- Returns:
- a
Task
containing the decoded value.
-
callFunction
public <ResultT> Task<ResultT> callFunction(String name, List<?> args, Class<ResultT> resultClass)
Description copied from interface:StitchServiceClient
Calls the specified Stitch service function, and decodes the response into an instance of the specified type. The response will be decoded using the codec registry specified when the app client was configured. If no codec registry was configured, a default codec registry will be used. The default codec registry supports the mappings specified here- Specified by:
callFunction
in interfaceStitchServiceClient
- Type Parameters:
ResultT
- the type into which the response will be decoded.- Parameters:
name
- the name of the Stitch service function to call.args
- the arguments to pass to the function.resultClass
- the class that the response should be decoded as.- Returns:
- a
Task
containing the decoded value.
-
callFunction
public <ResultT> Task<ResultT> callFunction(String name, List<?> args, Class<ResultT> resultClass, CodecRegistry codecRegistry)
Description copied from interface:StitchServiceClient
Calls the specified Stitch service function, and decodes the response into an instance of the specified type. The response will be decoded using the codec registry given.- Specified by:
callFunction
in interfaceStitchServiceClient
- Type Parameters:
ResultT
- the type into which the response will be decoded.- Parameters:
name
- the name of the Stitch service function to call.args
- the arguments to pass to the function.resultClass
- the class that the response should be decoded as.codecRegistry
- the codec registry used for de/serialization of the function call.- Returns:
- a
Task
containing the decoded value.
-
callFunction
public Task<Void> callFunction(String name, List<?> args, Long requestTimeout)
Description copied from interface:StitchServiceClient
Calls the specified Stitch service function. Also accepts a timeout in milliseconds. Use this for functions that may run longer than the client-wide default timeout (15 seconds by default).- Specified by:
callFunction
in interfaceStitchServiceClient
- Parameters:
name
- the name of the Stitch service function to call.args
- the arguments to pass to the function.requestTimeout
- the number of milliseconds the client should wait for a response from the server before failing with an error.- Returns:
- a
Task
that completes when the request completes.
-
callFunction
public <ResultT> Task<ResultT> callFunction(String name, List<?> args, Long requestTimeout, Class<ResultT> resultClass)
Description copied from interface:StitchServiceClient
Calls the specified Stitch service function, and decodes the response into an instance of the specified type. The response will be decoded using the codec registry specified when the app client was configured. If no codec registry was configured, a default codec registry will be used. The default codec registry supports the mappings specified here Also accepts a timeout in milliseconds. Use this for functions that may run longer than the client-wide default timeout (15 seconds by default).- Specified by:
callFunction
in interfaceStitchServiceClient
- Type Parameters:
ResultT
- the type into which the response will be decoded.- Parameters:
name
- the name of the Stitch service function to call.args
- the arguments to pass to the function.requestTimeout
- the number of milliseconds the client should wait for a response from the server before failing with an error.resultClass
- the class that the response should be decoded as.- Returns:
- a
Task
containing the decoded value.
-
callFunction
public <ResultT> Task<ResultT> callFunction(String name, List<?> args, Long requestTimeout, Decoder<ResultT> resultDecoder)
Description copied from interface:StitchServiceClient
Calls the specified Stitch service function, and decodes the response into a value using the providedDecoder
. Also accepts a timeout in milliseconds. Use this for functions that may run longer than the client-wide default timeout (15 seconds by default).- Specified by:
callFunction
in interfaceStitchServiceClient
- Type Parameters:
ResultT
- the type into which the response will be decoded.- Parameters:
name
- the name of the Stitch service function to call.args
- the arguments to pass to the function.requestTimeout
- the number of milliseconds the client should wait for a response from the server before failing with an error.resultDecoder
- theDecoder
to use to decode the response into a value.- Returns:
- a
Task
containing the decoded value.
-
callFunction
public <ResultT> Task<ResultT> callFunction(String name, List<?> args, Long requestTimeout, Class<ResultT> resultClass, CodecRegistry codecRegistry)
Description copied from interface:StitchServiceClient
Calls the specified Stitch service function, and decodes the response into an instance of the specified type. The response will be decoded using the codec registry given. Also accepts a timeout in milliseconds. Use this for functions that may run longer than the client-wide default timeout (15 seconds by default).- Specified by:
callFunction
in interfaceStitchServiceClient
- Type Parameters:
ResultT
- the type into which the response will be decoded.- Parameters:
name
- the name of the Stitch service function to call.args
- the arguments to pass to the function.requestTimeout
- the number of milliseconds the client should wait for a response from the server before failing with an error.resultClass
- the class that the response should be decoded as.codecRegistry
- the codec registry used for de/serialization of the function call.- Returns:
- a
Task
containing the decoded value.
-
getCodecRegistry
public CodecRegistry getCodecRegistry()
Description copied from interface:StitchServiceClient
Get the codec registry that will be used to decode responses when a codec registry.- Specified by:
getCodecRegistry
in interfaceStitchServiceClient
- Returns:
- the
CodecRegistry
-
withCodecRegistry
public StitchServiceClient withCodecRegistry(CodecRegistry codecRegistry)
Description copied from interface:StitchServiceClient
Create a new StitchServiceClient instance with a different codec registry.- Specified by:
withCodecRegistry
in interfaceStitchServiceClient
- Parameters:
codecRegistry
- the newCodecRegistry
for the service client.- Returns:
- a new StitchServiceClient instance with the different codec registry
-
-