Created
July 1, 2016 07:00
-
-
Save jpaseneta/cb4f9a6ea969a562308db191309d2fc1 to your computer and use it in GitHub Desktop.
proxy class
This file contains hidden or 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
package io.realm; | |
import android.util.JsonReader; | |
import android.util.JsonToken; | |
import io.realm.RealmFieldType; | |
import io.realm.exceptions.RealmMigrationNeededException; | |
import io.realm.internal.ColumnInfo; | |
import io.realm.internal.ImplicitTransaction; | |
import io.realm.internal.LinkView; | |
import io.realm.internal.RealmObjectProxy; | |
import io.realm.internal.Table; | |
import io.realm.internal.TableOrView; | |
import io.realm.internal.android.JsonUtils; | |
import java.io.IOException; | |
import java.util.ArrayList; | |
import java.util.Collections; | |
import java.util.Date; | |
import java.util.HashMap; | |
import java.util.Iterator; | |
import java.util.List; | |
import java.util.Map; | |
import org.json.JSONArray; | |
import org.json.JSONException; | |
import org.json.JSONObject; | |
public class RealmUserRealmProxy extends com.smartwavedev.genie.Model.RealmUser | |
implements RealmObjectProxy, RealmUserRealmProxyInterface { | |
static final class RealmUserColumnInfo extends ColumnInfo { | |
public final long idIndex; | |
public final long nameIndex; | |
public final long usernameIndex; | |
public final long emailIndex; | |
public final long phoneIndex; | |
public final long websiteIndex; | |
RealmUserColumnInfo(String path, Table table) { | |
final Map<String, Long> indicesMap = new HashMap<String, Long>(6); | |
this.idIndex = getValidColumnIndex(path, table, "RealmUser", "id"); | |
indicesMap.put("id", this.idIndex); | |
this.nameIndex = getValidColumnIndex(path, table, "RealmUser", "name"); | |
indicesMap.put("name", this.nameIndex); | |
this.usernameIndex = getValidColumnIndex(path, table, "RealmUser", "username"); | |
indicesMap.put("username", this.usernameIndex); | |
this.emailIndex = getValidColumnIndex(path, table, "RealmUser", "email"); | |
indicesMap.put("email", this.emailIndex); | |
this.phoneIndex = getValidColumnIndex(path, table, "RealmUser", "phone"); | |
indicesMap.put("phone", this.phoneIndex); | |
this.websiteIndex = getValidColumnIndex(path, table, "RealmUser", "website"); | |
indicesMap.put("website", this.websiteIndex); | |
setIndicesMap(indicesMap); | |
} | |
} | |
private final RealmUserColumnInfo columnInfo; | |
private final ProxyState proxyState; | |
private static final List<String> FIELD_NAMES; | |
static { | |
List<String> fieldNames = new ArrayList<String>(); | |
fieldNames.add("id"); | |
fieldNames.add("name"); | |
fieldNames.add("username"); | |
fieldNames.add("email"); | |
fieldNames.add("phone"); | |
fieldNames.add("website"); | |
FIELD_NAMES = Collections.unmodifiableList(fieldNames); | |
} | |
RealmUserRealmProxy(ColumnInfo columnInfo) { | |
this.columnInfo = (RealmUserColumnInfo) columnInfo; | |
this.proxyState = new ProxyState(com.smartwavedev.genie.Model.RealmUser.class, this); | |
} | |
@SuppressWarnings("cast") | |
public int realmGet$id() { | |
proxyState.getRealm$realm().checkIfValid(); | |
return (int) proxyState.getRow$realm().getLong(columnInfo.idIndex); | |
} | |
public void realmSet$id(int value) { | |
proxyState.getRealm$realm().checkIfValid(); | |
proxyState.getRow$realm().setLong(columnInfo.idIndex, value); | |
} | |
@SuppressWarnings("cast") | |
public String realmGet$name() { | |
proxyState.getRealm$realm().checkIfValid(); | |
return (java.lang.String) proxyState.getRow$realm().getString(columnInfo.nameIndex); | |
} | |
public void realmSet$name(String value) { | |
proxyState.getRealm$realm().checkIfValid(); | |
if (value == null) { | |
proxyState.getRow$realm().setNull(columnInfo.nameIndex); | |
return; | |
} | |
proxyState.getRow$realm().setString(columnInfo.nameIndex, value); | |
} | |
@SuppressWarnings("cast") | |
public String realmGet$username() { | |
proxyState.getRealm$realm().checkIfValid(); | |
return (java.lang.String) proxyState.getRow$realm().getString(columnInfo.usernameIndex); | |
} | |
public void realmSet$username(String value) { | |
proxyState.getRealm$realm().checkIfValid(); | |
if (value == null) { | |
proxyState.getRow$realm().setNull(columnInfo.usernameIndex); | |
return; | |
} | |
proxyState.getRow$realm().setString(columnInfo.usernameIndex, value); | |
} | |
@SuppressWarnings("cast") | |
public String realmGet$email() { | |
proxyState.getRealm$realm().checkIfValid(); | |
return (java.lang.String) proxyState.getRow$realm().getString(columnInfo.emailIndex); | |
} | |
public void realmSet$email(String value) { | |
proxyState.getRealm$realm().checkIfValid(); | |
if (value == null) { | |
proxyState.getRow$realm().setNull(columnInfo.emailIndex); | |
return; | |
} | |
proxyState.getRow$realm().setString(columnInfo.emailIndex, value); | |
} | |
@SuppressWarnings("cast") | |
public String realmGet$phone() { | |
proxyState.getRealm$realm().checkIfValid(); | |
return (java.lang.String) proxyState.getRow$realm().getString(columnInfo.phoneIndex); | |
} | |
public void realmSet$phone(String value) { | |
proxyState.getRealm$realm().checkIfValid(); | |
if (value == null) { | |
proxyState.getRow$realm().setNull(columnInfo.phoneIndex); | |
return; | |
} | |
proxyState.getRow$realm().setString(columnInfo.phoneIndex, value); | |
} | |
@SuppressWarnings("cast") | |
public String realmGet$website() { | |
proxyState.getRealm$realm().checkIfValid(); | |
return (java.lang.String) proxyState.getRow$realm().getString(columnInfo.websiteIndex); | |
} | |
public void realmSet$website(String value) { | |
proxyState.getRealm$realm().checkIfValid(); | |
if (value == null) { | |
proxyState.getRow$realm().setNull(columnInfo.websiteIndex); | |
return; | |
} | |
proxyState.getRow$realm().setString(columnInfo.websiteIndex, value); | |
} | |
public static Table initTable(ImplicitTransaction transaction) { | |
if (!transaction.hasTable("class_RealmUser")) { | |
Table table = transaction.getTable("class_RealmUser"); | |
table.addColumn(RealmFieldType.INTEGER, "id", Table.NOT_NULLABLE); | |
table.addColumn(RealmFieldType.STRING, "name", Table.NULLABLE); | |
table.addColumn(RealmFieldType.STRING, "username", Table.NULLABLE); | |
table.addColumn(RealmFieldType.STRING, "email", Table.NULLABLE); | |
table.addColumn(RealmFieldType.STRING, "phone", Table.NULLABLE); | |
table.addColumn(RealmFieldType.STRING, "website", Table.NULLABLE); | |
table.setPrimaryKey(""); | |
return table; | |
} | |
return transaction.getTable("class_RealmUser"); | |
} | |
public static RealmUserColumnInfo validateTable(ImplicitTransaction transaction) { | |
if (transaction.hasTable("class_RealmUser")) { | |
Table table = transaction.getTable("class_RealmUser"); | |
if (table.getColumnCount() != 6) { | |
throw new RealmMigrationNeededException(transaction.getPath(), "Field count does not match - expected 6 but was " + table.getColumnCount()); | |
} | |
Map<String, RealmFieldType> columnTypes = new HashMap<String, RealmFieldType>(); | |
for (long i = 0; i < 6; i++) { | |
columnTypes.put(table.getColumnName(i), table.getColumnType(i)); | |
} | |
final RealmUserColumnInfo columnInfo = new RealmUserColumnInfo(transaction.getPath(), table); | |
if (!columnTypes.containsKey("id")) { | |
throw new RealmMigrationNeededException(transaction.getPath(), "Missing field 'id' in existing Realm file. Either remove field or migrate using io.realm.internal.Table.addColumn()."); | |
} | |
if (columnTypes.get("id") != RealmFieldType.INTEGER) { | |
throw new RealmMigrationNeededException(transaction.getPath(), "Invalid type 'int' for field 'id' in existing Realm file."); | |
} | |
if (table.isColumnNullable(columnInfo.idIndex)) { | |
throw new RealmMigrationNeededException(transaction.getPath(), "Field 'id' does support null values in the existing Realm file. Use corresponding boxed type for field 'id' or migrate using RealmObjectSchema.setNullable()."); | |
} | |
if (!columnTypes.containsKey("name")) { | |
throw new RealmMigrationNeededException(transaction.getPath(), "Missing field 'name' in existing Realm file. Either remove field or migrate using io.realm.internal.Table.addColumn()."); | |
} | |
if (columnTypes.get("name") != RealmFieldType.STRING) { | |
throw new RealmMigrationNeededException(transaction.getPath(), "Invalid type 'String' for field 'name' in existing Realm file."); | |
} | |
if (!table.isColumnNullable(columnInfo.nameIndex)) { | |
throw new RealmMigrationNeededException(transaction.getPath(), "Field 'name' is required. Either set @Required to field 'name' or migrate using RealmObjectSchema.setNullable()."); | |
} | |
if (!columnTypes.containsKey("username")) { | |
throw new RealmMigrationNeededException(transaction.getPath(), "Missing field 'username' in existing Realm file. Either remove field or migrate using io.realm.internal.Table.addColumn()."); | |
} | |
if (columnTypes.get("username") != RealmFieldType.STRING) { | |
throw new RealmMigrationNeededException(transaction.getPath(), "Invalid type 'String' for field 'username' in existing Realm file."); | |
} | |
if (!table.isColumnNullable(columnInfo.usernameIndex)) { | |
throw new RealmMigrationNeededException(transaction.getPath(), "Field 'username' is required. Either set @Required to field 'username' or migrate using RealmObjectSchema.setNullable()."); | |
} | |
if (!columnTypes.containsKey("email")) { | |
throw new RealmMigrationNeededException(transaction.getPath(), "Missing field 'email' in existing Realm file. Either remove field or migrate using io.realm.internal.Table.addColumn()."); | |
} | |
if (columnTypes.get("email") != RealmFieldType.STRING) { | |
throw new RealmMigrationNeededException(transaction.getPath(), "Invalid type 'String' for field 'email' in existing Realm file."); | |
} | |
if (!table.isColumnNullable(columnInfo.emailIndex)) { | |
throw new RealmMigrationNeededException(transaction.getPath(), "Field 'email' is required. Either set @Required to field 'email' or migrate using RealmObjectSchema.setNullable()."); | |
} | |
if (!columnTypes.containsKey("phone")) { | |
throw new RealmMigrationNeededException(transaction.getPath(), "Missing field 'phone' in existing Realm file. Either remove field or migrate using io.realm.internal.Table.addColumn()."); | |
} | |
if (columnTypes.get("phone") != RealmFieldType.STRING) { | |
throw new RealmMigrationNeededException(transaction.getPath(), "Invalid type 'String' for field 'phone' in existing Realm file."); | |
} | |
if (!table.isColumnNullable(columnInfo.phoneIndex)) { | |
throw new RealmMigrationNeededException(transaction.getPath(), "Field 'phone' is required. Either set @Required to field 'phone' or migrate using RealmObjectSchema.setNullable()."); | |
} | |
if (!columnTypes.containsKey("website")) { | |
throw new RealmMigrationNeededException(transaction.getPath(), "Missing field 'website' in existing Realm file. Either remove field or migrate using io.realm.internal.Table.addColumn()."); | |
} | |
if (columnTypes.get("website") != RealmFieldType.STRING) { | |
throw new RealmMigrationNeededException(transaction.getPath(), "Invalid type 'String' for field 'website' in existing Realm file."); | |
} | |
if (!table.isColumnNullable(columnInfo.websiteIndex)) { | |
throw new RealmMigrationNeededException(transaction.getPath(), "Field 'website' is required. Either set @Required to field 'website' or migrate using RealmObjectSchema.setNullable()."); | |
} | |
return columnInfo; | |
} else { | |
throw new RealmMigrationNeededException(transaction.getPath(), "The RealmUser class is missing from the schema for this Realm."); | |
} | |
} | |
public static String getTableName() { | |
return "class_RealmUser"; | |
} | |
public static List<String> getFieldNames() { | |
return FIELD_NAMES; | |
} | |
@SuppressWarnings("cast") | |
public static com.smartwavedev.genie.Model.RealmUser createOrUpdateUsingJsonObject(Realm realm, JSONObject json, boolean update) | |
throws JSONException { | |
com.smartwavedev.genie.Model.RealmUser obj = realm.createObject(com.smartwavedev.genie.Model.RealmUser.class); | |
if (json.has("id")) { | |
if (json.isNull("id")) { | |
throw new IllegalArgumentException("Trying to set non-nullable field id to null."); | |
} else { | |
((RealmUserRealmProxyInterface) obj).realmSet$id((int) json.getInt("id")); | |
} | |
} | |
if (json.has("name")) { | |
if (json.isNull("name")) { | |
((RealmUserRealmProxyInterface) obj).realmSet$name(null); | |
} else { | |
((RealmUserRealmProxyInterface) obj).realmSet$name((String) json.getString("name")); | |
} | |
} | |
if (json.has("username")) { | |
if (json.isNull("username")) { | |
((RealmUserRealmProxyInterface) obj).realmSet$username(null); | |
} else { | |
((RealmUserRealmProxyInterface) obj).realmSet$username((String) json.getString("username")); | |
} | |
} | |
if (json.has("email")) { | |
if (json.isNull("email")) { | |
((RealmUserRealmProxyInterface) obj).realmSet$email(null); | |
} else { | |
((RealmUserRealmProxyInterface) obj).realmSet$email((String) json.getString("email")); | |
} | |
} | |
if (json.has("phone")) { | |
if (json.isNull("phone")) { | |
((RealmUserRealmProxyInterface) obj).realmSet$phone(null); | |
} else { | |
((RealmUserRealmProxyInterface) obj).realmSet$phone((String) json.getString("phone")); | |
} | |
} | |
if (json.has("website")) { | |
if (json.isNull("website")) { | |
((RealmUserRealmProxyInterface) obj).realmSet$website(null); | |
} else { | |
((RealmUserRealmProxyInterface) obj).realmSet$website((String) json.getString("website")); | |
} | |
} | |
return obj; | |
} | |
@SuppressWarnings("cast") | |
public static com.smartwavedev.genie.Model.RealmUser createUsingJsonStream(Realm realm, JsonReader reader) | |
throws IOException { | |
com.smartwavedev.genie.Model.RealmUser obj = realm.createObject(com.smartwavedev.genie.Model.RealmUser.class); | |
reader.beginObject(); | |
while (reader.hasNext()) { | |
String name = reader.nextName(); | |
if (name.equals("id")) { | |
if (reader.peek() == JsonToken.NULL) { | |
reader.skipValue(); | |
throw new IllegalArgumentException("Trying to set non-nullable field id to null."); | |
} else { | |
((RealmUserRealmProxyInterface) obj).realmSet$id((int) reader.nextInt()); | |
} | |
} else if (name.equals("name")) { | |
if (reader.peek() == JsonToken.NULL) { | |
reader.skipValue(); | |
((RealmUserRealmProxyInterface) obj).realmSet$name(null); | |
} else { | |
((RealmUserRealmProxyInterface) obj).realmSet$name((String) reader.nextString()); | |
} | |
} else if (name.equals("username")) { | |
if (reader.peek() == JsonToken.NULL) { | |
reader.skipValue(); | |
((RealmUserRealmProxyInterface) obj).realmSet$username(null); | |
} else { | |
((RealmUserRealmProxyInterface) obj).realmSet$username((String) reader.nextString()); | |
} | |
} else if (name.equals("email")) { | |
if (reader.peek() == JsonToken.NULL) { | |
reader.skipValue(); | |
((RealmUserRealmProxyInterface) obj).realmSet$email(null); | |
} else { | |
((RealmUserRealmProxyInterface) obj).realmSet$email((String) reader.nextString()); | |
} | |
} else if (name.equals("phone")) { | |
if (reader.peek() == JsonToken.NULL) { | |
reader.skipValue(); | |
((RealmUserRealmProxyInterface) obj).realmSet$phone(null); | |
} else { | |
((RealmUserRealmProxyInterface) obj).realmSet$phone((String) reader.nextString()); | |
} | |
} else if (name.equals("website")) { | |
if (reader.peek() == JsonToken.NULL) { | |
reader.skipValue(); | |
((RealmUserRealmProxyInterface) obj).realmSet$website(null); | |
} else { | |
((RealmUserRealmProxyInterface) obj).realmSet$website((String) reader.nextString()); | |
} | |
} else { | |
reader.skipValue(); | |
} | |
} | |
reader.endObject(); | |
return obj; | |
} | |
public static com.smartwavedev.genie.Model.RealmUser copyOrUpdate(Realm realm, com.smartwavedev.genie.Model.RealmUser object, boolean update, Map<RealmModel,RealmObjectProxy> cache) { | |
if (object instanceof RealmObjectProxy && ((RealmObjectProxy) object).realmGet$proxyState().getRealm$realm() != null && ((RealmObjectProxy) object).realmGet$proxyState().getRealm$realm().threadId != realm.threadId) { | |
throw new IllegalArgumentException("Objects which belong to Realm instances in other threads cannot be copied into this Realm instance."); | |
} | |
if (object instanceof RealmObjectProxy && ((RealmObjectProxy)object).realmGet$proxyState().getRealm$realm() != null && ((RealmObjectProxy)object).realmGet$proxyState().getRealm$realm().getPath().equals(realm.getPath())) { | |
return object; | |
} | |
RealmObjectProxy cachedRealmObject = cache.get(object); | |
if (cachedRealmObject != null) { | |
return (com.smartwavedev.genie.Model.RealmUser) cachedRealmObject; | |
} else { | |
return copy(realm, object, update, cache); | |
} | |
} | |
public static com.smartwavedev.genie.Model.RealmUser copy(Realm realm, com.smartwavedev.genie.Model.RealmUser newObject, boolean update, Map<RealmModel,RealmObjectProxy> cache) { | |
RealmObjectProxy cachedRealmObject = cache.get(newObject); | |
if (cachedRealmObject != null) { | |
return (com.smartwavedev.genie.Model.RealmUser) cachedRealmObject; | |
} else { | |
com.smartwavedev.genie.Model.RealmUser realmObject = realm.createObject(com.smartwavedev.genie.Model.RealmUser.class); | |
cache.put(newObject, (RealmObjectProxy) realmObject); | |
((RealmUserRealmProxyInterface) realmObject).realmSet$id(((RealmUserRealmProxyInterface) newObject).realmGet$id()); | |
((RealmUserRealmProxyInterface) realmObject).realmSet$name(((RealmUserRealmProxyInterface) newObject).realmGet$name()); | |
((RealmUserRealmProxyInterface) realmObject).realmSet$username(((RealmUserRealmProxyInterface) newObject).realmGet$username()); | |
((RealmUserRealmProxyInterface) realmObject).realmSet$email(((RealmUserRealmProxyInterface) newObject).realmGet$email()); | |
((RealmUserRealmProxyInterface) realmObject).realmSet$phone(((RealmUserRealmProxyInterface) newObject).realmGet$phone()); | |
((RealmUserRealmProxyInterface) realmObject).realmSet$website(((RealmUserRealmProxyInterface) newObject).realmGet$website()); | |
return realmObject; | |
} | |
} | |
public static long insert(Realm realm, com.smartwavedev.genie.Model.RealmUser object, Map<RealmModel,Long> cache) { | |
Table table = realm.getTable(com.smartwavedev.genie.Model.RealmUser.class); | |
long tableNativePtr = table.getNativeTablePointer(); | |
RealmUserColumnInfo columnInfo = (RealmUserColumnInfo) realm.schema.getColumnInfo(com.smartwavedev.genie.Model.RealmUser.class); | |
long rowIndex = Table.nativeAddEmptyRow(tableNativePtr, 1); | |
cache.put(object, rowIndex); | |
Table.nativeSetLong(tableNativePtr, columnInfo.idIndex, rowIndex, ((RealmUserRealmProxyInterface)object).realmGet$id()); | |
String realmGet$name = ((RealmUserRealmProxyInterface)object).realmGet$name(); | |
if (realmGet$name != null) { | |
Table.nativeSetString(tableNativePtr, columnInfo.nameIndex, rowIndex, realmGet$name); | |
} | |
String realmGet$username = ((RealmUserRealmProxyInterface)object).realmGet$username(); | |
if (realmGet$username != null) { | |
Table.nativeSetString(tableNativePtr, columnInfo.usernameIndex, rowIndex, realmGet$username); | |
} | |
String realmGet$email = ((RealmUserRealmProxyInterface)object).realmGet$email(); | |
if (realmGet$email != null) { | |
Table.nativeSetString(tableNativePtr, columnInfo.emailIndex, rowIndex, realmGet$email); | |
} | |
String realmGet$phone = ((RealmUserRealmProxyInterface)object).realmGet$phone(); | |
if (realmGet$phone != null) { | |
Table.nativeSetString(tableNativePtr, columnInfo.phoneIndex, rowIndex, realmGet$phone); | |
} | |
String realmGet$website = ((RealmUserRealmProxyInterface)object).realmGet$website(); | |
if (realmGet$website != null) { | |
Table.nativeSetString(tableNativePtr, columnInfo.websiteIndex, rowIndex, realmGet$website); | |
} | |
return rowIndex; | |
} | |
public static void insert(Realm realm, Iterator<? extends RealmModel> objects, Map<RealmModel,Long> cache) { | |
Table table = realm.getTable(com.smartwavedev.genie.Model.RealmUser.class); | |
long tableNativePtr = table.getNativeTablePointer(); | |
RealmUserColumnInfo columnInfo = (RealmUserColumnInfo) realm.schema.getColumnInfo(com.smartwavedev.genie.Model.RealmUser.class); | |
com.smartwavedev.genie.Model.RealmUser object = null; | |
while (objects.hasNext()) { | |
object = (com.smartwavedev.genie.Model.RealmUser) objects.next(); | |
if(!cache.containsKey(object)) { | |
long rowIndex = Table.nativeAddEmptyRow(tableNativePtr, 1); | |
cache.put(object, rowIndex); | |
Table.nativeSetLong(tableNativePtr, columnInfo.idIndex, rowIndex, ((RealmUserRealmProxyInterface)object).realmGet$id()); | |
String realmGet$name = ((RealmUserRealmProxyInterface)object).realmGet$name(); | |
if (realmGet$name != null) { | |
Table.nativeSetString(tableNativePtr, columnInfo.nameIndex, rowIndex, realmGet$name); | |
} | |
String realmGet$username = ((RealmUserRealmProxyInterface)object).realmGet$username(); | |
if (realmGet$username != null) { | |
Table.nativeSetString(tableNativePtr, columnInfo.usernameIndex, rowIndex, realmGet$username); | |
} | |
String realmGet$email = ((RealmUserRealmProxyInterface)object).realmGet$email(); | |
if (realmGet$email != null) { | |
Table.nativeSetString(tableNativePtr, columnInfo.emailIndex, rowIndex, realmGet$email); | |
} | |
String realmGet$phone = ((RealmUserRealmProxyInterface)object).realmGet$phone(); | |
if (realmGet$phone != null) { | |
Table.nativeSetString(tableNativePtr, columnInfo.phoneIndex, rowIndex, realmGet$phone); | |
} | |
String realmGet$website = ((RealmUserRealmProxyInterface)object).realmGet$website(); | |
if (realmGet$website != null) { | |
Table.nativeSetString(tableNativePtr, columnInfo.websiteIndex, rowIndex, realmGet$website); | |
} | |
} | |
} | |
} | |
public static long insertOrUpdate(Realm realm, com.smartwavedev.genie.Model.RealmUser object, Map<RealmModel,Long> cache) { | |
Table table = realm.getTable(com.smartwavedev.genie.Model.RealmUser.class); | |
long tableNativePtr = table.getNativeTablePointer(); | |
RealmUserColumnInfo columnInfo = (RealmUserColumnInfo) realm.schema.getColumnInfo(com.smartwavedev.genie.Model.RealmUser.class); | |
long rowIndex = Table.nativeAddEmptyRow(tableNativePtr, 1); | |
cache.put(object, rowIndex); | |
Table.nativeSetLong(tableNativePtr, columnInfo.idIndex, rowIndex, ((RealmUserRealmProxyInterface)object).realmGet$id()); | |
String realmGet$name = ((RealmUserRealmProxyInterface)object).realmGet$name(); | |
if (realmGet$name != null) { | |
Table.nativeSetString(tableNativePtr, columnInfo.nameIndex, rowIndex, realmGet$name); | |
} else { | |
Table.nativeSetNull(tableNativePtr, columnInfo.nameIndex, rowIndex); | |
} | |
String realmGet$username = ((RealmUserRealmProxyInterface)object).realmGet$username(); | |
if (realmGet$username != null) { | |
Table.nativeSetString(tableNativePtr, columnInfo.usernameIndex, rowIndex, realmGet$username); | |
} else { | |
Table.nativeSetNull(tableNativePtr, columnInfo.usernameIndex, rowIndex); | |
} | |
String realmGet$email = ((RealmUserRealmProxyInterface)object).realmGet$email(); | |
if (realmGet$email != null) { | |
Table.nativeSetString(tableNativePtr, columnInfo.emailIndex, rowIndex, realmGet$email); | |
} else { | |
Table.nativeSetNull(tableNativePtr, columnInfo.emailIndex, rowIndex); | |
} | |
String realmGet$phone = ((RealmUserRealmProxyInterface)object).realmGet$phone(); | |
if (realmGet$phone != null) { | |
Table.nativeSetString(tableNativePtr, columnInfo.phoneIndex, rowIndex, realmGet$phone); | |
} else { | |
Table.nativeSetNull(tableNativePtr, columnInfo.phoneIndex, rowIndex); | |
} | |
String realmGet$website = ((RealmUserRealmProxyInterface)object).realmGet$website(); | |
if (realmGet$website != null) { | |
Table.nativeSetString(tableNativePtr, columnInfo.websiteIndex, rowIndex, realmGet$website); | |
} else { | |
Table.nativeSetNull(tableNativePtr, columnInfo.websiteIndex, rowIndex); | |
} | |
return rowIndex; | |
} | |
public static void insertOrUpdate(Realm realm, Iterator<? extends RealmModel> objects, Map<RealmModel,Long> cache) { | |
Table table = realm.getTable(com.smartwavedev.genie.Model.RealmUser.class); | |
long tableNativePtr = table.getNativeTablePointer(); | |
RealmUserColumnInfo columnInfo = (RealmUserColumnInfo) realm.schema.getColumnInfo(com.smartwavedev.genie.Model.RealmUser.class); | |
com.smartwavedev.genie.Model.RealmUser object = null; | |
while (objects.hasNext()) { | |
object = (com.smartwavedev.genie.Model.RealmUser) objects.next(); | |
if(!cache.containsKey(object)) { | |
long rowIndex = Table.nativeAddEmptyRow(tableNativePtr, 1); | |
cache.put(object, rowIndex); | |
Table.nativeSetLong(tableNativePtr, columnInfo.idIndex, rowIndex, ((RealmUserRealmProxyInterface)object).realmGet$id()); | |
String realmGet$name = ((RealmUserRealmProxyInterface)object).realmGet$name(); | |
if (realmGet$name != null) { | |
Table.nativeSetString(tableNativePtr, columnInfo.nameIndex, rowIndex, realmGet$name); | |
} else { | |
Table.nativeSetNull(tableNativePtr, columnInfo.nameIndex, rowIndex); | |
} | |
String realmGet$username = ((RealmUserRealmProxyInterface)object).realmGet$username(); | |
if (realmGet$username != null) { | |
Table.nativeSetString(tableNativePtr, columnInfo.usernameIndex, rowIndex, realmGet$username); | |
} else { | |
Table.nativeSetNull(tableNativePtr, columnInfo.usernameIndex, rowIndex); | |
} | |
String realmGet$email = ((RealmUserRealmProxyInterface)object).realmGet$email(); | |
if (realmGet$email != null) { | |
Table.nativeSetString(tableNativePtr, columnInfo.emailIndex, rowIndex, realmGet$email); | |
} else { | |
Table.nativeSetNull(tableNativePtr, columnInfo.emailIndex, rowIndex); | |
} | |
String realmGet$phone = ((RealmUserRealmProxyInterface)object).realmGet$phone(); | |
if (realmGet$phone != null) { | |
Table.nativeSetString(tableNativePtr, columnInfo.phoneIndex, rowIndex, realmGet$phone); | |
} else { | |
Table.nativeSetNull(tableNativePtr, columnInfo.phoneIndex, rowIndex); | |
} | |
String realmGet$website = ((RealmUserRealmProxyInterface)object).realmGet$website(); | |
if (realmGet$website != null) { | |
Table.nativeSetString(tableNativePtr, columnInfo.websiteIndex, rowIndex, realmGet$website); | |
} else { | |
Table.nativeSetNull(tableNativePtr, columnInfo.websiteIndex, rowIndex); | |
} | |
} | |
} | |
} | |
public static com.smartwavedev.genie.Model.RealmUser createDetachedCopy(com.smartwavedev.genie.Model.RealmUser realmObject, int currentDepth, int maxDepth, Map<RealmModel, CacheData<RealmModel>> cache) { | |
if (currentDepth > maxDepth || realmObject == null) { | |
return null; | |
} | |
CacheData<RealmModel> cachedObject = cache.get(realmObject); | |
com.smartwavedev.genie.Model.RealmUser unmanagedObject; | |
if (cachedObject != null) { | |
// Reuse cached object or recreate it because it was encountered at a lower depth. | |
if (currentDepth >= cachedObject.minDepth) { | |
return (com.smartwavedev.genie.Model.RealmUser)cachedObject.object; | |
} else { | |
unmanagedObject = (com.smartwavedev.genie.Model.RealmUser)cachedObject.object; | |
cachedObject.minDepth = currentDepth; | |
} | |
} else { | |
unmanagedObject = new com.smartwavedev.genie.Model.RealmUser(); | |
cache.put(realmObject, new RealmObjectProxy.CacheData(currentDepth, unmanagedObject)); | |
} | |
((RealmUserRealmProxyInterface) unmanagedObject).realmSet$id(((RealmUserRealmProxyInterface) realmObject).realmGet$id()); | |
((RealmUserRealmProxyInterface) unmanagedObject).realmSet$name(((RealmUserRealmProxyInterface) realmObject).realmGet$name()); | |
((RealmUserRealmProxyInterface) unmanagedObject).realmSet$username(((RealmUserRealmProxyInterface) realmObject).realmGet$username()); | |
((RealmUserRealmProxyInterface) unmanagedObject).realmSet$email(((RealmUserRealmProxyInterface) realmObject).realmGet$email()); | |
((RealmUserRealmProxyInterface) unmanagedObject).realmSet$phone(((RealmUserRealmProxyInterface) realmObject).realmGet$phone()); | |
((RealmUserRealmProxyInterface) unmanagedObject).realmSet$website(((RealmUserRealmProxyInterface) realmObject).realmGet$website()); | |
return unmanagedObject; | |
} | |
@Override | |
public String toString() { | |
if (!RealmObject.isValid(this)) { | |
return "Invalid object"; | |
} | |
StringBuilder stringBuilder = new StringBuilder("RealmUser = ["); | |
stringBuilder.append("{id:"); | |
stringBuilder.append(realmGet$id()); | |
stringBuilder.append("}"); | |
stringBuilder.append(","); | |
stringBuilder.append("{name:"); | |
stringBuilder.append(realmGet$name() != null ? realmGet$name() : "null"); | |
stringBuilder.append("}"); | |
stringBuilder.append(","); | |
stringBuilder.append("{username:"); | |
stringBuilder.append(realmGet$username() != null ? realmGet$username() : "null"); | |
stringBuilder.append("}"); | |
stringBuilder.append(","); | |
stringBuilder.append("{email:"); | |
stringBuilder.append(realmGet$email() != null ? realmGet$email() : "null"); | |
stringBuilder.append("}"); | |
stringBuilder.append(","); | |
stringBuilder.append("{phone:"); | |
stringBuilder.append(realmGet$phone() != null ? realmGet$phone() : "null"); | |
stringBuilder.append("}"); | |
stringBuilder.append(","); | |
stringBuilder.append("{website:"); | |
stringBuilder.append(realmGet$website() != null ? realmGet$website() : "null"); | |
stringBuilder.append("}"); | |
stringBuilder.append("]"); | |
return stringBuilder.toString(); | |
} | |
@Override | |
public ProxyState realmGet$proxyState() { | |
return proxyState; | |
} | |
@Override | |
public int hashCode() { | |
String realmName = proxyState.getRealm$realm().getPath(); | |
String tableName = proxyState.getRow$realm().getTable().getName(); | |
long rowIndex = proxyState.getRow$realm().getIndex(); | |
int result = 17; | |
result = 31 * result + ((realmName != null) ? realmName.hashCode() : 0); | |
result = 31 * result + ((tableName != null) ? tableName.hashCode() : 0); | |
result = 31 * result + (int) (rowIndex ^ (rowIndex >>> 32)); | |
return result; | |
} | |
@Override | |
public boolean equals(Object o) { | |
if (this == o) return true; | |
if (o == null || getClass() != o.getClass()) return false; | |
RealmUserRealmProxy aRealmUser = (RealmUserRealmProxy)o; | |
String path = proxyState.getRealm$realm().getPath(); | |
String otherPath = aRealmUser.proxyState.getRealm$realm().getPath(); | |
if (path != null ? !path.equals(otherPath) : otherPath != null) return false;; | |
String tableName = proxyState.getRow$realm().getTable().getName(); | |
String otherTableName = aRealmUser.proxyState.getRow$realm().getTable().getName(); | |
if (tableName != null ? !tableName.equals(otherTableName) : otherTableName != null) return false; | |
if (proxyState.getRow$realm().getIndex() != aRealmUser.proxyState.getRow$realm().getIndex()) return false; | |
return true; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment