Newer
Older
OverlayMultiCounter / app / src / main / kotlin / jackall / overlaymulticounter / db / BaseRealmHelper.kt
MatsumotoKeiju on 9 Nov 2017 451 bytes [add] Counter realm helper
package jackall.overlaymulticounter.db

import io.realm.Realm
import io.realm.RealmModel
import io.realm.RealmResults

/**
 * Created by matsumoto_k on 2017/11/08.
 */
abstract class BaseRealmHelper<T : RealmModel> {
    protected val realm by lazy { Realm.getDefaultInstance() }
    abstract fun insert(realmObject: T)
    abstract fun update(realmObject: T)
    abstract fun findAll(): RealmResults<T>
    fun close() {
        realm.close()
    }
}