Package io.realm

Class RealmConfiguration

    • Method Detail

      • getRealmDirectory

        public File getRealmDirectory()
      • getRealmFileName

        public String getRealmFileName()
      • getEncryptionKey

        public byte[] getEncryptionKey()
      • getSchemaVersion

        public long getSchemaVersion()
      • shouldDeleteRealmIfMigrationNeeded

        public boolean shouldDeleteRealmIfMigrationNeeded()
      • getDurability

        public io.realm.internal.OsRealmConfig.Durability getDurability()
      • hasAssetFile

        public boolean hasAssetFile()
        Indicates if an asset file has been configured for this configuration.
        Returns:
        true if there is asset file, false otherwise.
      • getAssetFilePath

        @Nullable
        public String getAssetFilePath()
        Returns the path to the Realm asset file.
        Returns:
        path to the asset file relative to the asset directory or null if not asset file was specified.
      • getCompactOnLaunchCallback

        public CompactOnLaunchCallback 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.
      • getRealmObjectClasses

        public Set<Class<? extends RealmModel>> getRealmObjectClasses()
        Returns the unmodifiable Set of model classes that make up the schema for this Realm.
        Returns:
        unmodifiable Set of model classes.
      • getPath

        public String getPath()
        Returns the absolute path to where the Realm file will be saved.
        Returns:
        the absolute path to the Realm file defined by this configuration.
      • 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:
        UnsupportedOperationException - if the required coroutines framework is not on the classpath.
      • 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 BaseRealm.beginTransaction() is called on it.
        Returns:
        true if this Realm is read only, false if not.
      • isRecoveryConfiguration

        public boolean isRecoveryConfiguration()
        Returns:
        true if this configuration is intended to open a backup Realm (as a result of a client reset).
      • getMaxNumberOfActiveVersions

        public long getMaxNumberOfActiveVersions()
        Returns:
        the maximum number of active versions allowed before an exception is thrown.
      • 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 RealmConfiguration.Builder.allowQueriesOnUiThread(boolean) or its Realm Sync builder counterpart.

        Returns:
        whether or not queries are allowed to be run from the UI thread.
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object