Class RealmConfiguration
On this page
- io.realm
- Nested Class Summary
- Field Summary
- Method Summary
- Inherited Methods
- Field Detail
DEFAULT_REALM_NAME
- Method Detail
- createSchemaMediator
- equals
- forRecovery
- getAssetFilePath
- getCompactOnLaunchCallback
- getDurability
- getEncryptionKey
- getFlowFactory
- getInitialDataTransaction
- getInstance
- getMaxNumberOfActiveVersions
- getMigration
- getPath
- getRealmDirectory
- getRealmFileName
- getRealmObjectClasses
- getRxFactory
- getSchemaMediator
- getSchemaVersion
- hasAssetFile
- hashCode
- isAllowQueriesOnUiThread
- isAllowWritesOnUiThread
- isReadOnly
- isRecoveryConfiguration
- isSyncConfiguration
- realmExists
- shouldDeleteRealmIfMigrationNeeded
- toString
io.realm
A RealmConfiguration is used to setup a specific Realm instance.Instances of a RealmConfiguration can only created by using the io.realm.RealmConfiguration.Builder and calling its io.realm.RealmConfiguration.Builder.build() method.
A commonly used RealmConfiguration can easily be accessed by first saving it as Realm.setDefaultConfiguration(RealmConfiguration) and then using io.realm.Realm.getDefaultInstance() .
A minimal configuration can be created using:
RealmConfiguration config = new RealmConfiguration.Builder().build()
This will create a RealmConfiguration with the following properties.
Realm file is called "default.realm"
It is saved in Context.getFilesDir()
It has its schema version set to 0.
Nested Class Summary
Modifier and Type | Class and Description |
---|---|
public static |
Field Summary
Modifier and Type | Field and Description |
---|---|
public static final String |
Method Summary
Modifier and Type | Method and Description |
---|---|
protected static RealmProxyMediator | java.util.Set<java.lang.Object> modules, boolean excludeDebugSchema ) |
public boolean | |
protected static RealmConfiguration | |
public String | Returns the path to the Realm asset file. |
public CompactOnLaunchCallback | Returns a callback to determine if the Realm file should be compacted before being returned to the user. |
public OsRealmConfig.Durability | |
public byte | |
public FlowFactory | Returns the FlowFactory that is used to create Kotlin Flows from Realm objects. |
protected Realm.Transaction | Returns the transaction instance with initial data. |
protected Realm | |
public long | |
public RealmMigration | getMigration () |
public String | getPath () Returns the absolute path to where the Realm file will be saved. |
public File | |
public String | |
public Set | Returns the unmodifiable Set of model classes that make up the schema for this Realm. |
public RxObservableFactory | getRxFactory () Returns the RxObservableFactory that is used to create Rx Observables from Realm objects. |
protected RealmProxyMediator | Returns the mediator instance of schema which is defined by this configuration. |
public long | |
public boolean | hasAssetFile () Indicates if an asset file has been configured for this configuration. |
public int | hashCode () |
public boolean | Returns whether a RealmQuery is allowed to be launched from the UI thread. |
public boolean | Returns whether calls to Realm.executeTransaction can be done on the UI thread. |
public boolean | isReadOnly () Returns whether this Realm is read-only or not. |
public boolean | |
protected boolean | |
protected boolean | realmExists () Checks if the Realm file defined by this configuration already exists. |
public boolean | |
public String | toString () |
Inherited Methods
Methods inherited from class java.lang.Object :
getClass
,hashCode
,equals
,clone
,toString
,notify
,notifyAll
,wait
,wait
,wait
,finalize
Field Detail
DEFAULT_REALM_NAME
Method Detail
createSchemaMediator
protected static RealmProxyMediator createSchemaMediator ( java.util.Set<java.lang.Object> modules, boolean excludeDebugSchema ) |
---|
equals
forRecovery
protected static RealmConfiguration forRecovery ( ) |
---|
getAssetFilePath
public String getAssetFilePath () |
---|
Returns the path to the Realm asset file. Returns path to the asset file relative to the asset directory or |
getCompactOnLaunchCallback
Returns a callback to determine if the Realm file should be compacted before being returned to the user. Returns a callback called when opening a Realm for the first time during the life of a process to determine if it should be compacted before being returned to the user. It is passed the total file size (data + free space) and the total bytes used by data in the file. |
getDurability
public OsRealmConfig.Durability getDurability () |
---|
getEncryptionKey
public byte getEncryptionKey () |
---|
getFlowFactory
public FlowFactory getFlowFactory () |
---|
Returns the FlowFactory that is used to create Kotlin Flows from Realm objects. Returns the factory instance used to create Flows. Throws
|
getInitialDataTransaction
protected Realm.Transaction getInitialDataTransaction () |
---|
Returns the transaction instance with initial data. Returns the initial data transaction. |
getInstance
getMaxNumberOfActiveVersions
public long getMaxNumberOfActiveVersions () |
---|
Returns the maximum number of active versions allowed before an exception is thrown. |
getMigration
public RealmMigration getMigration () |
---|
getPath
getRealmDirectory
public File getRealmDirectory () |
---|
getRealmFileName
public String getRealmFileName () |
---|
getRealmObjectClasses
public Set getRealmObjectClasses () |
---|
getRxFactory
public RxObservableFactory getRxFactory () |
---|
Returns the RxObservableFactory that is used to create Rx Observables from Realm objects. Returns the factory instance used to create Rx Observables. Throws
|
getSchemaMediator
protected RealmProxyMediator getSchemaMediator () |
---|
Returns the mediator instance of schema which is defined by this configuration. Returns the mediator of the schema. |
getSchemaVersion
public long getSchemaVersion () |
---|
hasAssetFile
public boolean hasAssetFile () |
---|
Indicates if an asset file has been configured for this configuration. Returns
|
hashCode
isAllowQueriesOnUiThread
public boolean isAllowQueriesOnUiThread () |
---|
Returns whether a RealmQuery is allowed to be launched from the UI thread. By default Realm allows queries on the main thread. To disallow this users have to explicitly opt in with Builder.allowQueriesOnUiThread(boolean) or its Realm Sync builder counterpart. Returns whether or not queries are allowed to be run from the UI thread. |
isAllowWritesOnUiThread
public boolean isAllowWritesOnUiThread () |
---|
Returns whether calls to Realm.executeTransaction can be done on the UI thread. Note: Realm does not allow blocking transactions to be run on the main thread unless users explicitly opt in with Builder.allowWritesOnUiThread(boolean) or its Realm Sync builder counterpart. Returns whether or not write operations are allowed to be run from the UI thread. |
isReadOnly
public boolean isReadOnly () |
---|
Returns whether this Realm is read-only or not. Read-only Realms cannot be modified and will throw an IllegalStateException if Realm.beginTransaction() is called on it. Returns
|
isRecoveryConfiguration
public boolean isRecoveryConfiguration () |
---|
Returns
TipSee also:
|
isSyncConfiguration
protected boolean isSyncConfiguration () |
---|
realmExists
protected boolean realmExists () |
---|
Checks if the Realm file defined by this configuration already exists.WARNING: This method is just a point-in-time check. Unless protected by external synchronization another thread or process might have created or deleted the Realm file right after this method has returned. Returns
|
shouldDeleteRealmIfMigrationNeeded
public boolean shouldDeleteRealmIfMigrationNeeded () |
---|