Module com.gluonhq.cloudlink.client
Class RemoteFunctionBuilder
- java.lang.Object
-
- com.gluonhq.cloudlink.client.data.RemoteFunctionBuilder
-
public class RemoteFunctionBuilder extends Object
A utility class for buildingRemoteFunction
instances.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description RemoteFunctionBuilder
cachingEnabled(boolean cachingEnabled)
Defines whether the responses from calls to the remote function should be cached locally in the private storage of the device's platform.RemoteFunctionChunkedList
chunkedList()
Make an instance ofRemoteFunctionChunkedList
based on the properties set on this builder.static RemoteFunctionBuilder
create(String functionName)
Create a new instance of RemoteFunctionBuilder that can be used to build instances of RemoteFunction.RemoteFunctionList
list()
Make an instance ofRemoteFunctionList
based on the properties set on this builder.RemoteFunctionObject
object()
Make an instance ofRemoteFunctionObject
based on the properties set on this builder.RemoteFunctionBuilder
param(String key, String value)
Adds a function parameter with the specifiedkey
andvalue
.RemoteFunctionBuilder
rawBody(byte[] rawBody)
Defines the bytes that are sent as the raw body when executing the request to the remote function.
-
-
-
Method Detail
-
create
public static RemoteFunctionBuilder create(String functionName)
Create a new instance of RemoteFunctionBuilder that can be used to build instances of RemoteFunction. The providedfunctionName
must map with the name of a remote function that is configured in Gluon CloudLink.- Parameters:
functionName
- the name of the configured remote function to call- Returns:
- a new instance of RemoteFunctionBuilder
-
cachingEnabled
public RemoteFunctionBuilder cachingEnabled(boolean cachingEnabled)
Defines whether the responses from calls to the remote function should be cached locally in the private storage of the device's platform. Local caching is enabled by default.- Parameters:
cachingEnabled
-true
to enable local caching,false
to disable it- Returns:
- A reference to this builder.
- See Also:
RemoteFunction.isCachingEnabled()
-
param
public RemoteFunctionBuilder param(String key, String value)
Adds a function parameter with the specifiedkey
andvalue
. If a parameter with the specifiedkey
was already provided before, the old value will be overwritten with the specifiedvalue
.- Parameters:
key
- the name of the parametervalue
- the value of the parameter- Returns:
- A reference to this builder.
- See Also:
RemoteFunction.getParams()
-
rawBody
public RemoteFunctionBuilder rawBody(byte[] rawBody)
Defines the bytes that are sent as the raw body when executing the request to the remote function.- Parameters:
rawBody
- the raw bytes to sent as the raw body for the remote function- Returns:
- A reference to this builder.
- See Also:
RemoteFunction.getRawBody()
-
object
public RemoteFunctionObject object()
Make an instance ofRemoteFunctionObject
based on the properties set on this builder.- Returns:
- The constructed RemoteFunctionObject instance.
-
list
public RemoteFunctionList list()
Make an instance ofRemoteFunctionList
based on the properties set on this builder.- Returns:
- The constructed RemoteFunctionList instance.
-
chunkedList
public RemoteFunctionChunkedList chunkedList()
Make an instance ofRemoteFunctionChunkedList
based on the properties set on this builder.- Returns:
- The constructed RemoteFunctionChunkedList instance.
-
-