本文整理匯總了Java中io.realm.RealmConfiguration.Builder方法的典型用法代碼示例。如果您正苦於以下問題:Java RealmConfiguration.Builder方法的具體用法?Java RealmConfiguration.Builder怎麽用?Java RealmConfiguration.Builder使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類io.realm.RealmConfiguration
的用法示例。
在下文中一共展示了RealmConfiguration.Builder方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getRealm
import io.realm.RealmConfiguration; //導入方法依賴的package包/類
private synchronized SharedRealm getRealm(String path) {
SharedRealm realm = realms.get(path);
if (realm == null) {
final File realmFile = new File(path);
final RealmConfiguration.Builder builder =
new RealmConfiguration.Builder().directory(realmFile.getParentFile())
.name(realmFile.getName());
final byte[] encryptionKey = encryptionKeys.get(realmFile.getName());
if (encryptionKey != null && encryptionKey.length > 0) {
builder.encryptionKey(encryptionKey);
}
realm = SharedRealm.getInstance(builder.build());
realms.put(path, realm);
}
return realm;
}
示例2: provideRealmConfiguration
import io.realm.RealmConfiguration; //導入方法依賴的package包/類
@Provides
@PerApplication
static RealmConfiguration provideRealmConfiguration() {
RealmConfiguration.Builder builder = new RealmConfiguration.Builder();
if (BuildConfig.DEBUG) {
builder = builder.deleteRealmIfMigrationNeeded();
}
return builder.build();
}
示例3: initDefaultRealm
import io.realm.RealmConfiguration; //導入方法依賴的package包/類
public static void initDefaultRealm(@NonNull String dbSuffix, int version, RealmMigration realmMigration) {
Realm.removeDefaultConfiguration();
RealmConfiguration.Builder builder = new RealmConfiguration.Builder()
.name("db_realm_" + dbSuffix)
.schemaVersion(version)
.rxFactory(new RealmObservableFactory());
// .deleteRealmIfMigrationNeeded();
if (realmMigration != null)
builder.migration(realmMigration);
RealmConfiguration realmConfiguration = builder.build();
Realm.setDefaultConfiguration(realmConfiguration);
}
示例4: provideRealmConfiguration
import io.realm.RealmConfiguration; //導入方法依賴的package包/類
@Provides
@Singleton
RealmConfiguration provideRealmConfiguration(@ApplicationContext Context context) {
Realm.init(context);
RealmConfiguration.Builder builder = new RealmConfiguration.Builder().
deleteRealmIfMigrationNeeded();
builder.name("default.realm");
return builder.build();
}
示例5: onCreate
import io.realm.RealmConfiguration; //導入方法依賴的package包/類
@Override
public void onCreate() {
super.onCreate();
Realm.init(this);
RealmConfiguration.Builder config = new RealmConfiguration.Builder()
.name("kutuk.realm")
.schemaVersion(SCHEMA_VERSION);
if (BuildConfig.DEBUG) {
config.deleteRealmIfMigrationNeeded();
} else {
config.migration(new Migration());
}
Realm.setDefaultConfiguration(config.build());
}
示例6: createConfigurationBuilder
import io.realm.RealmConfiguration; //導入方法依賴的package包/類
public RealmConfiguration.Builder createConfigurationBuilder() {
return new RealmConfiguration.Builder().directory(getRoot());
}
示例7: provideRealmConfiguration
import io.realm.RealmConfiguration; //導入方法依賴的package包/類
@Provides
static RealmConfiguration provideRealmConfiguration(){
RealmConfiguration.Builder builder = new RealmConfiguration.Builder();
if(BuildConfig.DEBUG) { builder = builder.deleteRealmIfMigrationNeeded(); }
return builder.build();
}