Newer
Older
MonCalc / app / src / main / kotlin / jackall / moncalc / db / FruitRealmHelper.kt
package jackall.moncalc.db

import io.realm.Realm
import jackall.moncalc.vo.Fruit

/**
 * Created by matsumoto_k on 2017/11/02.
 */
class FruitRealmHelper : RealmHelper<Fruit>() {
    override fun insert(mRealm: Realm, realmObject: Fruit) {
        mRealm.executeTransaction {
            mRealm.copyToRealmOrUpdate(realmObject)
        }
    }

    override fun insert(mRealm: Realm, realmObject: List<Fruit>) {
        mRealm.executeTransaction {
            mRealm.copyToRealmOrUpdate(realmObject)
        }
    }

    override fun findAll(mRealm: Realm): List<Fruit> {
        return mRealm.where(Fruit::class.java).findAll()
    }
}