public static class AppConfiguration.Builder extends Object
AppConfiguration
in a fluent manner.Constructor and Description |
---|
Builder(String appId)
Creates an instance of the Builder for the AppConfiguration.
|
Modifier and Type | Method and Description |
---|---|
AppConfiguration.Builder |
addCustomRequestHeader(String headerName,
String headerValue)
Adds an extra HTTP header to append to every request to a Realm Object Server.
|
AppConfiguration.Builder |
addCustomRequestHeaders(Map<String,String> headers)
Adds extra HTTP headers to append to every request to a Realm Object Server.
|
AppConfiguration.Builder |
appName(String appName)
Sets the apps name.
|
AppConfiguration.Builder |
appVersion(String appVersion)
Sets the apps version.
|
AppConfiguration.Builder |
authorizationHeaderName(String headerName)
Sets the name of the HTTP header used to send authorization data in when making requests to
MongoDB Realm.
|
AppConfiguration.Builder |
baseUrl(String baseUrl)
Sets the base url for the MongoDB Realm Application.
|
AppConfiguration |
build()
Creates the AppConfiguration.
|
AppConfiguration.Builder |
codecRegistry(CodecRegistry codecRegistry)
Set the default codec registry used to encode and decode BSON arguments and results when
calling remote Realm
Functions and accessing a remote
MongoDatabase . |
AppConfiguration.Builder |
defaultSyncErrorHandler(SyncSession.ErrorHandler errorHandler)
Sets the default error handler used by Synced Realms when reporting errors with their
session.
|
AppConfiguration.Builder |
encryptionKey(byte[] key)
Sets the encryption key used to encrypt user meta data only.
|
AppConfiguration.Builder |
requestTimeout(long time,
TimeUnit unit)
Sets the default timeout used by network requests against the MongoDB Realm application.
|
AppConfiguration.Builder |
syncRootDirectory(File rootDir)
Configures the root folder containing all files and Realms used when synchronizing data
between the device and MongoDB Realm.
|
public Builder(String appId)
appId
- the application id of the MongoDB Realm Application.public AppConfiguration.Builder encryptionKey(byte[] key)
SyncConfiguration.Builder.encryptionKey(byte[])
to make them encrypted.key
- a 64 byte encryption key.IllegalArgumentException
- if the key is not 64 bytes long.public AppConfiguration.Builder baseUrl(String baseUrl)
AppConfiguration.DEFAULT_BASE_URL
.baseUrl
- the base url for the MongoDB Realm application.public AppConfiguration.Builder appName(String appName)
appName
- app name used to identify the application.public AppConfiguration.Builder appVersion(String appVersion)
appVersion
- app version used to identify the application.public AppConfiguration.Builder requestTimeout(long time, TimeUnit unit)
AppConfiguration.DEFAULT_REQUEST_TIMEOUT
seconds.time
- the timeout value for network requests.unit
- the unit of time used to define the timeout.public AppConfiguration.Builder authorizationHeaderName(String headerName)
The default authorization header is named AppConfiguration.DEFAULT_AUTHORIZATION_HEADER_NAME
.
headerName
- name of the header.IllegalArgumentException
- if a null or empty header is provided.public AppConfiguration.Builder addCustomRequestHeader(String headerName, String headerValue)
headerName
- the name of the header.headerValue
- the value of header.IllegalArgumentException
- if a non-empty headerName
is provided or a null headerValue
.public AppConfiguration.Builder addCustomRequestHeaders(Map<String,String> headers)
headers
- map of (headerName, headerValue) pairs.IllegalArgumentException
- If any of the headers provided are illegal.public AppConfiguration.Builder defaultSyncErrorHandler(SyncSession.ErrorHandler errorHandler)
This default can be overridden by calling
SyncConfiguration.Builder.errorHandler(SyncSession.ErrorHandler)
when creating
the SyncConfiguration
.
errorHandler
- the default error handler.public AppConfiguration.Builder syncRootDirectory(File rootDir)
The default root dir is Context.getFilesDir()/mongodb-realm
.
rootDir
- where to store sync related files.public AppConfiguration.Builder codecRegistry(CodecRegistry codecRegistry)
Functions
and accessing a remote
MongoDatabase
.
Will default to AppConfiguration.DEFAULT_BSON_CODEC_REGISTRY
if not specified.
codecRegistry
- The default codec registry for the App.AppConfiguration.DEFAULT_BSON_CODEC_REGISTRY
,
AppConfiguration.getDefaultCodecRegistry()
public AppConfiguration build()
App
.