Class DittoConfig.Builder
java.lang.Object
com.ditto.java.DittoConfig.Builder
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceFunctional interface for configuring experimental features. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()Builds theDittoConfig.connect(@NonNull DittoConfig.Connect connect) Sets the connection configuration.databaseId(@NonNull String databaseId) Sets the database ID.experimental(@NonNull DittoConfig.Builder.ExperimentalConfigurer configure) Configures experimental features.persistenceDirectory(@Nullable File persistenceDirectory) Sets the persistence directory.persistenceDirectory(@Nullable String persistenceDirectory) Sets the persistence directory.serverConnect(@NonNull String url) Sets the connection to use a Big Peer server with the specified URL.serverConnect(@NonNull URI url) Sets the connection to use a Big Peer server with the specified URL.smallPeersOnlyConnect(@Nullable String privateKey) Sets the connection to use small peers only mode with the specified private key.
-
Constructor Details
-
Builder
Creates a new Builder with the specified database ID.- Parameters:
databaseId- the database ID for this Ditto instance.
-
-
Method Details
-
databaseId
Sets the database ID.- Parameters:
databaseId- the database ID for this Ditto instance.- Returns:
- this builder for method chaining.
-
connect
Sets the connection configuration.- Parameters:
connect- theDittoConfig.Connectconfiguration.- Returns:
- this builder for method chaining.
-
serverConnect
Sets the connection to use a Big Peer server with the specified URL.- Parameters:
url- the server URL as aURI.- Returns:
- this builder for method chaining.
-
serverConnect
Sets the connection to use a Big Peer server with the specified URL.- Parameters:
url- the server URL as a string.- Returns:
- this builder for method chaining.
-
smallPeersOnlyConnect
Sets the connection to use small peers only mode with the specified private key.- Parameters:
privateKey- the private key for this peer, or null to auto-generate one.- Returns:
- this builder for method chaining.
-
persistenceDirectory
Sets the persistence directory.- Parameters:
persistenceDirectory- the persistence directory as aFile, or null for default.- Returns:
- this builder for method chaining.
-
persistenceDirectory
Sets the persistence directory.- Parameters:
persistenceDirectory- the persistence directory path, or null for default.- Returns:
- this builder for method chaining.
-
experimental
public DittoConfig.Builder experimental(@NonNull DittoConfig.Builder.ExperimentalConfigurer configure) Configures experimental features.- Parameters:
configure- a function that configures theDittoConfig.Experimental.Builder.- Returns:
- this builder for method chaining.
-
build
Builds theDittoConfig.- Returns:
- a new
DittoConfiginstance with the configured settings.
-