public abstract class Functions extends Object
Arguments and results are encoded/decoded with the Functions' codec registry either
inherited from the AppConfiguration.getDefaultCodecRegistry() or set explicitly
when creating the Functions-instance through User.getFunctions(CodecRegistry)
or through the individual calls to callFunction(String, List, Class, CodecRegistry).
User.getFunctions(),
User.getFunctions(CodecRegistry),
App.getFunctions(User),
App.getFunctions(User, CodecRegistry),
AppConfiguration,
CodecRegistry| Modifier and Type | Method and Description |
|---|---|
<ResultT> ResultT |
callFunction(String name,
List<?> args,
<any> resultDecoder)
Call a MongoDB Realm function synchronously with custom result decoder.
|
<ResultT> ResultT |
callFunction(String name,
List<?> args,
Class<ResultT> resultClass)
Call a MongoDB Realm function synchronously with default codec registry encoding/decoding
arguments/results.
|
<ResultT> ResultT |
callFunction(String name,
List<?> args,
Class<ResultT> resultClass,
CodecRegistry codecRegistry)
Call a MongoDB Realm function synchronously with custom codec registry encoding/decoding
arguments/results.
|
<T> RealmAsyncTask |
callFunctionAsync(String name,
List<?> args,
<any> resultDecoder,
App.Callback<T> callback)
Call a MongoDB Realm function asynchronously with custom result decoder.
|
<T> RealmAsyncTask |
callFunctionAsync(String name,
List<?> args,
Class<T> resultClass,
App.Callback<T> callback)
Call a MongoDB Realm function asynchronously with custom codec registry for encoding/decoding
arguments/results.
|
<T> RealmAsyncTask |
callFunctionAsync(String name,
List<?> args,
Class<T> resultClass,
CodecRegistry codecRegistry,
App.Callback<T> callback)
Call a MongoDB Realm function asynchronously with custom codec registry for encoding/decoding
arguments/results.
|
App |
getApp()
Returns the
App that this instance in associated with. |
CodecRegistry |
getDefaultCodecRegistry()
Returns the default codec registry used for encoding arguments and decoding results for this
Realm functions instance.
|
User |
getUser()
Returns the
User that this instance in associated with. |
public <ResultT> ResultT callFunction(String name, List<?> args, Class<ResultT> resultClass, CodecRegistry codecRegistry)
ResultT - The type that the response will be decoded as using the codecRegistry.name - Name of the Realm function to call.args - Arguments to the Realm function.resultClass - The type that the functions result should be converted to.codecRegistry - Codec registry to use for argument encoding and result decoding.AppException - if the request failed in some way.callFunctionAsync(String, List, Class, CodecRegistry, App.Callback),
AppConfiguration.getDefaultCodecRegistry()public <ResultT> ResultT callFunction(String name, List<?> args, Class<ResultT> resultClass)
ResultT - The type that the response will be decoded as using the default codec registry.name - Name of the Realm function to call.args - Arguments to the Realm function.resultClass - The type that the functions result should be converted to.AppException - if the request failed in some way.callFunction(String, List, Class, CodecRegistry),
AppConfiguration.getDefaultCodecRegistry()public <ResultT> ResultT callFunction(String name, List<?> args, <any> resultDecoder)
The arguments will be encoded with the default codec registry encoding.
ResultT - The type that the response will be decoded as using the resultDecodername - Name of the Realm function to call.args - Arguments to the Realm function.resultDecoder - The decoder used to decode the result.AppException - if the request failed in some way.callFunction(String, List, Class, CodecRegistry),
AppConfiguration.getDefaultCodecRegistry()public <T> RealmAsyncTask callFunctionAsync(String name, List<?> args, Class<T> resultClass, CodecRegistry codecRegistry, App.Callback<T> callback)
This is the asynchronous equivalent of callFunction(String, List, Class, CodecRegistry).
T - The type that the response will be decoded as using the default codec registry.name - Name of the Realm function to call.args - Arguments to the Realm function.resultClass - The type that the functions result should be converted to.codecRegistry - Codec registry to use for argument encoding and result decoding.callback - The callback that will receive the result or any errors from the request.IllegalStateException - if not called on a looper thread.callFunction(String, List, Class, CodecRegistry),
callFunctionAsync(String, List, Class, CodecRegistry, App.Callback),
AppConfiguration.getDefaultCodecRegistry()public <T> RealmAsyncTask callFunctionAsync(String name, List<?> args, Class<T> resultClass, App.Callback<T> callback)
This is the asynchronous equivalent of callFunction(String, List, Class).
T - The type that the response will be decoded as using the default codec registry.name - Name of the Realm function to call.args - Arguments to the Realm function.resultClass - The type that the functions result should be converted to.callback - The callback that will receive the result or any errors from the request.IllegalStateException - if not called on a looper thread.callFunction(String, List, Class),
callFunctionAsync(String, List, Class, CodecRegistry, App.Callback),
AppConfiguration.getDefaultCodecRegistry()public <T> RealmAsyncTask callFunctionAsync(String name, List<?> args, <any> resultDecoder, App.Callback<T> callback)
This is the asynchronous equivalent of #callFunction(String, List, Decoder).
T - The type that the response will be decoded as using the resultDecodername - Name of the Realm function to call.args - Arguments to the Realm function.resultDecoder - The decoder used to decode the result.callback - The callback that will receive the result or any errors from the request.IllegalStateException - if not called on a looper thread.callFunction(String, List, Class),
callFunctionAsync(String, List, Class, CodecRegistry, App.Callback),
AppConfiguration.getDefaultCodecRegistry()public CodecRegistry getDefaultCodecRegistry()
public App getApp()
App that this instance in associated with.App that this instance in associated with.