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 buildingRemoteFunctioninstances.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description RemoteFunctionBuildercachingEnabled(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.RemoteFunctionChunkedListchunkedList()Make an instance ofRemoteFunctionChunkedListbased on the properties set on this builder.static RemoteFunctionBuildercreate(String functionName)Create a new instance of RemoteFunctionBuilder that can be used to build instances of RemoteFunction.RemoteFunctionListlist()Make an instance ofRemoteFunctionListbased on the properties set on this builder.RemoteFunctionObjectobject()Make an instance ofRemoteFunctionObjectbased on the properties set on this builder.RemoteFunctionBuilderparam(String key, String value)Adds a function parameter with the specifiedkeyandvalue.RemoteFunctionBuilderrawBody(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 providedfunctionNamemust 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-trueto enable local caching,falseto 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 specifiedkeyandvalue. If a parameter with the specifiedkeywas 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 ofRemoteFunctionObjectbased on the properties set on this builder.- Returns:
- The constructed RemoteFunctionObject instance.
-
list
public RemoteFunctionList list()
Make an instance ofRemoteFunctionListbased on the properties set on this builder.- Returns:
- The constructed RemoteFunctionList instance.
-
chunkedList
public RemoteFunctionChunkedList chunkedList()
Make an instance ofRemoteFunctionChunkedListbased on the properties set on this builder.- Returns:
- The constructed RemoteFunctionChunkedList instance.
-
-