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