use of io.realm.internal.UncheckedRow in project realm-java by realm.
the class BaseRealm method get.
<E extends RealmModel> E get(Class<E> clazz, long rowIndex, boolean acceptDefaultValue, List<String> excludeFields) {
Table table = schema.getTable(clazz);
UncheckedRow row = table.getUncheckedRow(rowIndex);
E result = configuration.getSchemaMediator().newInstance(clazz, this, row, schema.getColumnInfo(clazz), acceptDefaultValue, excludeFields);
RealmObjectProxy proxy = (RealmObjectProxy) result;
proxy.realmGet$proxyState().setTableVersion$realm();
return result;
}
use of io.realm.internal.UncheckedRow in project realm-java by realm.
the class OrderedRealmCollectionSnapshot method deleteLastFromRealm.
/**
* Deletes the last object from the Realm. The last object will become invalid.
*
* @return {@code true} if an object was deleted, {@code false} otherwise.
* @throws java.lang.IllegalStateException if the Realm is closed or the method is called from the wrong thread.
*/
@Override
public boolean deleteLastFromRealm() {
realm.checkIfValidAndInTransaction();
UncheckedRow row = collection.lastUncheckedRow();
return row != null && row.isAttached() && collection.deleteLast();
}
use of io.realm.internal.UncheckedRow in project realm-java by realm.
the class OrderedRealmCollectionSnapshot method deleteFirstFromRealm.
/**
* Deletes the first object from the Realm. The first object will become invalid.
*
* @return {@code true} if an object was deleted, {@code false} otherwise.
* @throws java.lang.IllegalStateException if the Realm is closed or the method is called on the wrong thread.
*/
@Override
public boolean deleteFirstFromRealm() {
realm.checkIfValidAndInTransaction();
UncheckedRow row = collection.firstUncheckedRow();
return row != null && row.isAttached() && collection.deleteFirst();
}
use of io.realm.internal.UncheckedRow in project realm-java by realm.
the class OrderedRealmCollectionSnapshot method deleteFromRealm.
/**
* Deletes the object at the given index from the Realm. The object at the given index will become invalid. Just
* returns if the object is invalid already.
*
* @param location the array index identifying the object to be removed.
* @throws IndexOutOfBoundsException if {@code location < 0 || location >= size()}.
* @throws java.lang.IllegalStateException if the Realm is closed or the method is called from the wrong thread.
*/
@Override
public void deleteFromRealm(int location) {
realm.checkIfValidAndInTransaction();
UncheckedRow row = collection.getUncheckedRow(location);
if (row.isAttached()) {
collection.delete(location);
}
}
use of io.realm.internal.UncheckedRow in project realm-java by realm.
the class RealmResults method createBacklinkResults.
static <T extends RealmModel> RealmResults<T> createBacklinkResults(BaseRealm realm, Row row, Class<T> srcTableType, String srcFieldName) {
if (!(row instanceof UncheckedRow)) {
throw new IllegalArgumentException("Row is " + row.getClass());
}
UncheckedRow uncheckedRow = (UncheckedRow) row;
Table srcTable = realm.getSchema().getTable(srcTableType);
return new RealmResults<T>(realm, Collection.createBacklinksCollection(realm.sharedRealm, uncheckedRow, srcTable, srcFieldName), srcTableType);
}
Aggregations