use of io.realm.internal.Row in project realm-java by realm.
the class RealmObject method deleteFromRealm.
/**
* Deletes the object from the Realm it is currently associated with.
* <p>
* After this method is called the object will be invalid and any operation (read or write) performed on it will
* fail with an IllegalStateException.
*
* @throws IllegalStateException if the corresponding Realm is closed or in an incorrect thread.
* @see #isValid()
*/
public static <E extends RealmModel> void deleteFromRealm(E object) {
if (!(object instanceof RealmObjectProxy)) {
// TODO What type of exception IllegalArgument/IllegalState?
throw new IllegalArgumentException("Object not managed by Realm, so it cannot be removed.");
}
RealmObjectProxy proxy = (RealmObjectProxy) object;
if (proxy.realmGet$proxyState().getRow$realm() == null) {
throw new IllegalStateException("Object malformed: missing object in Realm. Make sure to instantiate RealmObjects with Realm.createObject()");
}
if (proxy.realmGet$proxyState().getRealm$realm() == null) {
throw new IllegalStateException("Object malformed: missing Realm. Make sure to instantiate RealmObjects with Realm.createObject()");
}
proxy.realmGet$proxyState().getRealm$realm().checkIfValid();
Row row = proxy.realmGet$proxyState().getRow$realm();
row.getTable().moveLastOver(row.getIndex());
proxy.realmGet$proxyState().setRow$realm(InvalidRow.INSTANCE);
}
use of io.realm.internal.Row in project realm-java by realm.
the class AllTypesRealmProxy method realmSet$columnBoolean.
public void realmSet$columnBoolean(boolean value) {
if (proxyState.isUnderConstruction()) {
if (!proxyState.getAcceptDefaultValue$realm()) {
return;
}
final Row row = proxyState.getRow$realm();
row.getTable().setBoolean(columnInfo.columnBooleanIndex, row.getIndex(), value, true);
return;
}
proxyState.getRealm$realm().checkIfValid();
proxyState.getRow$realm().setBoolean(columnInfo.columnBooleanIndex, value);
}
use of io.realm.internal.Row in project realm-java by realm.
the class AllTypesRealmProxy method realmSet$columnDate.
public void realmSet$columnDate(Date value) {
if (proxyState.isUnderConstruction()) {
if (!proxyState.getAcceptDefaultValue$realm()) {
return;
}
final Row row = proxyState.getRow$realm();
if (value == null) {
throw new IllegalArgumentException("Trying to set non-nullable field 'columnDate' to null.");
}
row.getTable().setDate(columnInfo.columnDateIndex, row.getIndex(), value, true);
return;
}
proxyState.getRealm$realm().checkIfValid();
if (value == null) {
throw new IllegalArgumentException("Trying to set non-nullable field 'columnDate' to null.");
}
proxyState.getRow$realm().setDate(columnInfo.columnDateIndex, value);
}
use of io.realm.internal.Row in project realm-java by realm.
the class NullTypesRealmProxy method realmSet$fieldShortNull.
public void realmSet$fieldShortNull(Short value) {
if (proxyState.isUnderConstruction()) {
if (!proxyState.getAcceptDefaultValue$realm()) {
return;
}
final Row row = proxyState.getRow$realm();
if (value == null) {
row.getTable().setNull(columnInfo.fieldShortNullIndex, row.getIndex(), true);
return;
}
row.getTable().setLong(columnInfo.fieldShortNullIndex, row.getIndex(), value, true);
return;
}
proxyState.getRealm$realm().checkIfValid();
if (value == null) {
proxyState.getRow$realm().setNull(columnInfo.fieldShortNullIndex);
return;
}
proxyState.getRow$realm().setLong(columnInfo.fieldShortNullIndex, value);
}
use of io.realm.internal.Row in project realm-java by realm.
the class NullTypesRealmProxy method realmSet$fieldByteNull.
public void realmSet$fieldByteNull(Byte value) {
if (proxyState.isUnderConstruction()) {
if (!proxyState.getAcceptDefaultValue$realm()) {
return;
}
final Row row = proxyState.getRow$realm();
if (value == null) {
row.getTable().setNull(columnInfo.fieldByteNullIndex, row.getIndex(), true);
return;
}
row.getTable().setLong(columnInfo.fieldByteNullIndex, row.getIndex(), value, true);
return;
}
proxyState.getRealm$realm().checkIfValid();
if (value == null) {
proxyState.getRow$realm().setNull(columnInfo.fieldByteNullIndex);
return;
}
proxyState.getRow$realm().setLong(columnInfo.fieldByteNullIndex, value);
}
Aggregations