本文整理汇总了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();
}