当前位置: 首页>>代码示例>>Java>>正文


Java RealmConfiguration.Builder方法代码示例

本文整理汇总了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;
}
 
开发者ID:xizzhu,项目名称:stetho-realm,代码行数:17,代码来源:Database.java

示例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();
}
 
开发者ID:aprochukhan,项目名称:Android-MVVM-Example,代码行数:10,代码来源:AppModule.java

示例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);
    }
 
开发者ID:Jusenr,项目名称:androidgithub,代码行数:14,代码来源:DBManager.java

示例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();
}
 
开发者ID:schul-cloud,项目名称:schulcloud-mobile-android,代码行数:10,代码来源:ApplicationModule.java

示例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());
}
 
开发者ID:SeriousBug,项目名称:Kutuk,代码行数:15,代码来源:KutukApp.java

示例6: createConfigurationBuilder

import io.realm.RealmConfiguration; //导入方法依赖的package包/类
public RealmConfiguration.Builder createConfigurationBuilder() {
    return new RealmConfiguration.Builder().directory(getRoot());
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:4,代码来源:TestRealmConfigurationFactory.java

示例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();
}
 
开发者ID:domgeorg,项目名称:INFOotball,代码行数:7,代码来源:AppModule.java


注:本文中的io.realm.RealmConfiguration.Builder方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。