package jackall.moncalc.db import io.realm.RealmResults import jackall.moncalc.vo.Temple /** * Created by matsumoto_k on 2017/11/02. */ class TempleRealmHelper : RealmHelper<Temple>() { override fun insert(realmObject: Temple) { realm.executeTransaction { realm.copyToRealm(realmObject) } } override fun insert(realmObject: List<Temple>) { realm.executeTransaction { realm.copyToRealm(realmObject) } } override fun update(realmObject: Temple) { realm.executeTransaction { realm.copyToRealmOrUpdate(realmObject) } } override fun update(realmObjects: List<Temple>) { realm.executeTransaction { realm.copyToRealmOrUpdate(realmObjects) } } override fun findAll(): RealmResults<Temple> { return realm.where(Temple::class.java).findAll() } fun findNames(): List<String> { val results = ArrayList<String>() realm.where(Temple::class.java).findAll().forEach { results.add(it.name) } return results } }