public static some.test.Booleans createDetachedCopy( some.test.Booleans realmObject, int currentDepth, int maxDepth, Map<RealmModel, CacheData<RealmModel>> cache) { if (currentDepth > maxDepth || realmObject == null) { return null; } CacheData<RealmModel> cachedObject = cache.get(realmObject); some.test.Booleans unmanagedObject; if (cachedObject != null) { // Reuse cached object or recreate it because it was encountered at a lower depth. if (currentDepth >= cachedObject.minDepth) { return (some.test.Booleans) cachedObject.object; } else { unmanagedObject = (some.test.Booleans) cachedObject.object; cachedObject.minDepth = currentDepth; } } else { unmanagedObject = new some.test.Booleans(); cache.put(realmObject, new RealmObjectProxy.CacheData(currentDepth, unmanagedObject)); } ((BooleansRealmProxyInterface) unmanagedObject) .realmSet$done(((BooleansRealmProxyInterface) realmObject).realmGet$done()); ((BooleansRealmProxyInterface) unmanagedObject) .realmSet$isReady(((BooleansRealmProxyInterface) realmObject).realmGet$isReady()); ((BooleansRealmProxyInterface) unmanagedObject) .realmSet$mCompleted(((BooleansRealmProxyInterface) realmObject).realmGet$mCompleted()); ((BooleansRealmProxyInterface) unmanagedObject) .realmSet$anotherBoolean( ((BooleansRealmProxyInterface) realmObject).realmGet$anotherBoolean()); return unmanagedObject; }
@SuppressWarnings("cast") public static some.test.Booleans createUsingJsonStream(Realm realm, JsonReader reader) throws IOException { some.test.Booleans obj = realm.createObject(some.test.Booleans.class); reader.beginObject(); while (reader.hasNext()) { String name = reader.nextName(); if (name.equals("done")) { if (reader.peek() == JsonToken.NULL) { reader.skipValue(); throw new IllegalArgumentException("Trying to set non-nullable field 'done' to null."); } else { ((BooleansRealmProxyInterface) obj).realmSet$done((boolean) reader.nextBoolean()); } } else if (name.equals("isReady")) { if (reader.peek() == JsonToken.NULL) { reader.skipValue(); throw new IllegalArgumentException("Trying to set non-nullable field 'isReady' to null."); } else { ((BooleansRealmProxyInterface) obj).realmSet$isReady((boolean) reader.nextBoolean()); } } else if (name.equals("mCompleted")) { if (reader.peek() == JsonToken.NULL) { reader.skipValue(); throw new IllegalArgumentException( "Trying to set non-nullable field 'mCompleted' to null."); } else { ((BooleansRealmProxyInterface) obj).realmSet$mCompleted((boolean) reader.nextBoolean()); } } else if (name.equals("anotherBoolean")) { if (reader.peek() == JsonToken.NULL) { reader.skipValue(); throw new IllegalArgumentException( "Trying to set non-nullable field 'anotherBoolean' to null."); } else { ((BooleansRealmProxyInterface) obj) .realmSet$anotherBoolean((boolean) reader.nextBoolean()); } } else { reader.skipValue(); } } reader.endObject(); return obj; }
@SuppressWarnings("cast") public static some.test.Booleans createOrUpdateUsingJsonObject( Realm realm, JSONObject json, boolean update) throws JSONException { some.test.Booleans obj = realm.createObject(some.test.Booleans.class); if (json.has("done")) { if (json.isNull("done")) { throw new IllegalArgumentException("Trying to set non-nullable field 'done' to null."); } else { ((BooleansRealmProxyInterface) obj).realmSet$done((boolean) json.getBoolean("done")); } } if (json.has("isReady")) { if (json.isNull("isReady")) { throw new IllegalArgumentException("Trying to set non-nullable field 'isReady' to null."); } else { ((BooleansRealmProxyInterface) obj).realmSet$isReady((boolean) json.getBoolean("isReady")); } } if (json.has("mCompleted")) { if (json.isNull("mCompleted")) { throw new IllegalArgumentException( "Trying to set non-nullable field 'mCompleted' to null."); } else { ((BooleansRealmProxyInterface) obj) .realmSet$mCompleted((boolean) json.getBoolean("mCompleted")); } } if (json.has("anotherBoolean")) { if (json.isNull("anotherBoolean")) { throw new IllegalArgumentException( "Trying to set non-nullable field 'anotherBoolean' to null."); } else { ((BooleansRealmProxyInterface) obj) .realmSet$anotherBoolean((boolean) json.getBoolean("anotherBoolean")); } } return obj; }
public static some.test.Booleans copy( Realm realm, some.test.Booleans newObject, boolean update, Map<RealmModel, RealmObjectProxy> cache) { RealmObjectProxy cachedRealmObject = cache.get(newObject); if (cachedRealmObject != null) { return (some.test.Booleans) cachedRealmObject; } else { some.test.Booleans realmObject = realm.createObject(some.test.Booleans.class); cache.put(newObject, (RealmObjectProxy) realmObject); ((BooleansRealmProxyInterface) realmObject) .realmSet$done(((BooleansRealmProxyInterface) newObject).realmGet$done()); ((BooleansRealmProxyInterface) realmObject) .realmSet$isReady(((BooleansRealmProxyInterface) newObject).realmGet$isReady()); ((BooleansRealmProxyInterface) realmObject) .realmSet$mCompleted(((BooleansRealmProxyInterface) newObject).realmGet$mCompleted()); ((BooleansRealmProxyInterface) realmObject) .realmSet$anotherBoolean( ((BooleansRealmProxyInterface) newObject).realmGet$anotherBoolean()); return realmObject; } }