Created
May 18, 2016 16:42
-
-
Save Komarev/0064f3f37f21dde6032a3f7d8ba386a5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Override | |
public <T extends RealmModel> Observable<T> get(Class<T> clazz, String primaryKey, | |
int pkValue) { | |
return Observable.fromCallable(() -> { | |
Realm realm = getRealmInstance(); | |
T object = realm.copyFromRealm(realm.where(clazz) | |
.equalTo(primaryKey, pkValue) | |
.findFirst()); | |
realm.close(); | |
return object; | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment