Search in sources :

Example 1 with RealmConfiguration

use of io.realm.RealmConfiguration in project FastAdapter by mikepenz.

the class CustomApplication method onCreate.

@Override
public void onCreate() {
    super.onCreate();
    // The Realm file will be located in Context.getFilesDir() with name "default.realm"
    RealmConfiguration config = new RealmConfiguration.Builder(this).build();
    Realm.setDefaultConfiguration(config);
}
Also used : RealmConfiguration(io.realm.RealmConfiguration)

Example 2 with RealmConfiguration

use of io.realm.RealmConfiguration in project simple-stack by Zhuinden.

the class DatabaseManager method init.

public void init(Context context) {
    Realm.init(context);
    RealmConfiguration realmConfiguration = new RealmConfiguration.Builder().deleteRealmIfMigrationNeeded().build();
    Realm.setDefaultConfiguration(realmConfiguration);
}
Also used : RealmConfiguration(io.realm.RealmConfiguration)

Example 3 with RealmConfiguration

use of io.realm.RealmConfiguration in project realm-java by realm.

the class RealmBenchmarks method before.

@BeforeExperiment
public void before() {
    Realm.init(InstrumentationRegistry.getTargetContext());
    coldConfig = new RealmConfiguration.Builder().name("cold").build();
    RealmConfiguration config = new RealmConfiguration.Builder().build();
    Realm.deleteRealm(coldConfig);
    Realm.deleteRealm(config);
    realm = Realm.getInstance(config);
    realm.executeTransaction(new Realm.Transaction() {

        @Override
        public void execute(Realm realm) {
            readObject = realm.createObject(AllTypes.class);
            readObject.setColumnString("Foo");
            readObject.setColumnLong(42);
            readObject.setColumnDouble(1.234D);
        }
    });
}
Also used : RealmConfiguration(io.realm.RealmConfiguration) Realm(io.realm.Realm) BeforeExperiment(dk.ilios.spanner.BeforeExperiment)

Example 4 with RealmConfiguration

use of io.realm.RealmConfiguration in project realm-java by realm.

the class RealmObjectWriteBenchmarks method before.

@BeforeExperiment
public void before() {
    RealmConfiguration config = new RealmConfiguration.Builder().build();
    Realm.deleteRealm(config);
    realm = Realm.getInstance(config);
    realm.beginTransaction();
    writeObject = realm.createObject(AllTypes.class);
}
Also used : RealmConfiguration(io.realm.RealmConfiguration) AllTypes(io.realm.entities.AllTypes) BeforeExperiment(dk.ilios.spanner.BeforeExperiment)

Example 5 with RealmConfiguration

use of io.realm.RealmConfiguration in project realm-java by realm.

the class RealmQueryBenchmarks method before.

@BeforeExperiment
public void before() {
    RealmConfiguration config = new RealmConfiguration.Builder().build();
    Realm.deleteRealm(config);
    realm = Realm.getInstance(config);
    realm.beginTransaction();
    for (int i = 0; i < DATA_SIZE; i++) {
        AllTypes obj = realm.createObject(AllTypes.class);
        obj.setColumnLong(i);
        obj.setColumnBoolean(i % 2 == 0);
        obj.setColumnString("Foo " + i);
        obj.setColumnDouble(i + 1.234D);
    }
    realm.commitTransaction();
}
Also used : RealmConfiguration(io.realm.RealmConfiguration) AllTypes(io.realm.entities.AllTypes) BeforeExperiment(dk.ilios.spanner.BeforeExperiment)

Aggregations

RealmConfiguration (io.realm.RealmConfiguration)64 Realm (io.realm.Realm)20 DynamicRealm (io.realm.DynamicRealm)17 Scheduler (io.reactivex.Scheduler)14 RealmChangeListener (io.realm.RealmChangeListener)8 BeforeExperiment (dk.ilios.spanner.BeforeExperiment)6 Before (org.junit.Before)5 DynamicRealmObject (io.realm.DynamicRealmObject)4 RealmList (io.realm.RealmList)4 RealmResults (io.realm.RealmResults)4 ArrayList (java.util.ArrayList)4 Test (org.junit.Test)4 Context (android.content.Context)3 OrderedCollectionChangeSet (io.realm.OrderedCollectionChangeSet)3 OrderedRealmCollectionChangeListener (io.realm.OrderedRealmCollectionChangeListener)3 RealmObjectSchema (io.realm.RealmObjectSchema)3 AllTypes (io.realm.entities.AllTypes)3 IntentFilter (android.content.IntentFilter)2 LinearLayout (android.widget.LinearLayout)2 RealmSchema (io.realm.RealmSchema)2