public class RealmConfiguration extends Object
Instances of a RealmConfiguration can only created by using the RealmConfiguration.Builder
and calling
its RealmConfiguration.Builder.build()
method.
A commonly used RealmConfiguration can easily be accessed by first saving it as
Realm.setDefaultConfiguration(RealmConfiguration)
and then using Realm.getDefaultInstance()
.
A minimal configuration can be created using:
RealmConfiguration config = new RealmConfiguration.Builder().build()
This will create a RealmConfiguration with the following properties.
Modifier and Type | Class and Description |
---|---|
static class |
RealmConfiguration.Builder
RealmConfiguration.Builder used to construct instances of a RealmConfiguration in a fluent manner.
|
Modifier and Type | Field and Description |
---|---|
static String |
DEFAULT_REALM_NAME |
static int |
KEY_LENGTH |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj) |
CompactOnLaunchCallback |
getCompactOnLaunchCallback()
Returns a callback to determine if the Realm file should be compacted before being returned to the user.
|
OsRealmConfig.Durability |
getDurability() |
byte[] |
getEncryptionKey() |
RealmMigration |
getMigration() |
String |
getPath()
Returns the absolute path to where the Realm file will be saved.
|
File |
getRealmDirectory() |
String |
getRealmFileName() |
Set<Class<? extends RealmModel>> |
getRealmObjectClasses()
Returns the unmodifiable
Set of model classes that make up the schema for this Realm. |
RxObservableFactory |
getRxFactory()
Returns the
RxObservableFactory that is used to create Rx Observables from Realm objects. |
long |
getSchemaVersion() |
int |
hashCode() |
boolean |
isReadOnly()
Returns whether this Realm is read-only or not.
|
boolean |
isRecoveryConfiguration() |
boolean |
shouldDeleteRealmIfMigrationNeeded() |
String |
toString() |
public static final String DEFAULT_REALM_NAME
public static final int KEY_LENGTH
public File getRealmDirectory()
public String getRealmFileName()
public byte[] getEncryptionKey()
public long getSchemaVersion()
public RealmMigration getMigration()
public boolean shouldDeleteRealmIfMigrationNeeded()
public OsRealmConfig.Durability getDurability()
public CompactOnLaunchCallback getCompactOnLaunchCallback()
public Set<Class<? extends RealmModel>> getRealmObjectClasses()
Set
of model classes that make up the schema for this Realm.Set
of model classes.public String getPath()
public RxObservableFactory getRxFactory()
RxObservableFactory
that is used to create Rx Observables from Realm objects.UnsupportedOperationException
- if the required RxJava framework is not on the classpath.public boolean isReadOnly()
IllegalStateException
if BaseRealm.beginTransaction()
is called on it.true
if this Realm is read only, false
if not.public boolean isRecoveryConfiguration()
true
if this configuration is intended to open a backup Realm (as a result of a client reset).