SharedBuilder

abstract class SharedBuilder<T, S : RealmConfiguration.SharedBuilder<T, S>>(schema: Set<KClass<out RealmObject>>)

This class contains shared properties across the two types of configuration builders. Abstracting this allows for minimal rewiring by the compiler plugin since build is available to both builders.

The property functions in this builder return the type of the builder itself, represented by S. This is due to library-base not having visibility over library-sync and therefore all function return types have to be typecast as S.

Parameters

T

the type of RealmConfiguration the builder should generate

S

the type of builder, needed to distinguish between local and sync variants.

Constructors

SharedBuilder
Link copied to clipboard
common
fun SharedBuilder(schema: Set<KClass<out RealmObject>> = setOf())
the type of RealmConfiguration the builder should generate

Functions

build
Link copied to clipboard
common
fun build(): T
Creates the RealmConfiguration based on the builder properties.
deleteRealmIfMigrationNeeded
Link copied to clipboard
common
fun deleteRealmIfMigrationNeeded(): S
Setting this will change the behavior of how migration exceptions are handled.
encryptionKey
Link copied to clipboard
common
fun encryptionKey(encryptionKey: ByteArray): S
Sets the 64 byte key used to encrypt and decrypt the Realm file.
log
Link copied to clipboard
common
fun log(level: LogLevel = LogLevel.WARN, customLoggers: List<RealmLogger> = emptyList()): S
Configure how Realm will report log events.
maxNumberOfActiveVersions
Link copied to clipboard
common
fun maxNumberOfActiveVersions(maxVersions: Long = 8): S
Sets the maximum number of live versions in the Realm file before an IllegalStateException is thrown when attempting to write more data.
name
Link copied to clipboard
common
fun name(name: String): S
Sets the filename of the realm file.
path
Link copied to clipboard
common
fun path(path: String?): S
Sets the absolute path of the realm file.
schema
Link copied to clipboard
common
fun schema(vararg classes: KClass<out RealmObject>): S
Sets the classes of the schema.
fun schema(classes: Set<KClass<out RealmObject>>): S
Sets the classes of the schema.
schemaVersion
Link copied to clipboard
common
fun schemaVersion(schemaVersion: Long): S
Sets the schema version of the Realm.

Properties

schema
Link copied to clipboard
common
var schema: Set<KClass<out RealmObject>>

Inheritors

RealmConfiguration
Link copied to clipboard