Module com.gluonhq.cloudlink.client
Class DataClientBuilder
- java.lang.Object
-
- com.gluonhq.cloudlink.client.data.DataClientBuilder
-
public class DataClientBuilder extends Object
A utility class for buildingDataClient
instances.
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
DataClientBuilder()
Default constructor
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description DataClientBuilder
authenticateWith(UserClient userClient)
Specifies that authentication should be enabled for the DataClient instance that will be constructed by this builder.DataClient
build()
Make an instance of DataClient based on the properties set on this builder.static DataClientBuilder
create()
Create a new instance of DataClientBuilder that can be used to build instances of DataClient.DataClientBuilder
operationMode(OperationMode operationMode)
Set the value of the operation mode for the DataClient instance constructed by this builder.
-
-
-
Method Detail
-
create
public static DataClientBuilder create()
Create a new instance of DataClientBuilder that can be used to build instances of DataClient.- Returns:
- a new instance of DataClientBuilder
-
authenticateWith
public DataClientBuilder authenticateWith(UserClient userClient)
Specifies that authentication should be enabled for the DataClient instance that will be constructed by this builder. When accessing data, the provided UserClient will be used to ensure that an authenticated user is available. When a UserClient is not set, the authentication process will not be started when accessing data.- Parameters:
userClient
- the instance of the UserClient to use for authentication- Returns:
- A reference to this builder.
-
operationMode
public DataClientBuilder operationMode(OperationMode operationMode)
Set the value of the operation mode for the DataClient instance constructed by this builder. When not specified, the default value isOperationMode.CLOUD_FIRST
.Note: when the cloudlink configuration file is not provided, the DataClient will always fall back to
OperationMode.LOCAL_ONLY
.- Parameters:
operationMode
- the operation mode used when working with data- Returns:
- A reference to this builder.
- See Also:
DataClient.getOperationMode()
-
build
public DataClient build()
Make an instance of DataClient based on the properties set on this builder.- Returns:
- The constructed DataClient instance.
-
-