Ejemplo n.º 1
0
 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;
 }
Ejemplo n.º 2
0
 public static some.test.Simple createDetachedCopy(
     some.test.Simple 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.Simple 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.Simple) cachedObject.object;
     } else {
       unmanagedObject = (some.test.Simple) cachedObject.object;
       cachedObject.minDepth = currentDepth;
     }
   } else {
     unmanagedObject = new some.test.Simple();
     cache.put(realmObject, new RealmObjectProxy.CacheData(currentDepth, unmanagedObject));
   }
   ((SimpleRealmProxyInterface) unmanagedObject)
       .realmSet$name(((SimpleRealmProxyInterface) realmObject).realmGet$name());
   ((SimpleRealmProxyInterface) unmanagedObject)
       .realmSet$age(((SimpleRealmProxyInterface) realmObject).realmGet$age());
   return unmanagedObject;
 }