當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。