예제 #1
0
 public static void insertOrUpdate(
     Realm realm, Iterator<? extends RealmModel> objects, Map<RealmModel, Long> cache) {
   Table table = realm.getTable(some.test.Booleans.class);
   long tableNativePtr = table.getNativeTablePointer();
   BooleansColumnInfo columnInfo =
       (BooleansColumnInfo) realm.schema.getColumnInfo(some.test.Booleans.class);
   some.test.Booleans object = null;
   while (objects.hasNext()) {
     object = (some.test.Booleans) objects.next();
     if (!cache.containsKey(object)) {
       long rowIndex = Table.nativeAddEmptyRow(tableNativePtr, 1);
       cache.put(object, rowIndex);
       Table.nativeSetBoolean(
           tableNativePtr,
           columnInfo.doneIndex,
           rowIndex,
           ((BooleansRealmProxyInterface) object).realmGet$done());
       Table.nativeSetBoolean(
           tableNativePtr,
           columnInfo.isReadyIndex,
           rowIndex,
           ((BooleansRealmProxyInterface) object).realmGet$isReady());
       Table.nativeSetBoolean(
           tableNativePtr,
           columnInfo.mCompletedIndex,
           rowIndex,
           ((BooleansRealmProxyInterface) object).realmGet$mCompleted());
       Table.nativeSetBoolean(
           tableNativePtr,
           columnInfo.anotherBooleanIndex,
           rowIndex,
           ((BooleansRealmProxyInterface) object).realmGet$anotherBoolean());
     }
   }
 }
예제 #2
0
 public static long insertOrUpdate(
     Realm realm, some.test.Booleans object, Map<RealmModel, Long> cache) {
   Table table = realm.getTable(some.test.Booleans.class);
   long tableNativePtr = table.getNativeTablePointer();
   BooleansColumnInfo columnInfo =
       (BooleansColumnInfo) realm.schema.getColumnInfo(some.test.Booleans.class);
   long rowIndex = Table.nativeAddEmptyRow(tableNativePtr, 1);
   cache.put(object, rowIndex);
   Table.nativeSetBoolean(
       tableNativePtr,
       columnInfo.doneIndex,
       rowIndex,
       ((BooleansRealmProxyInterface) object).realmGet$done());
   Table.nativeSetBoolean(
       tableNativePtr,
       columnInfo.isReadyIndex,
       rowIndex,
       ((BooleansRealmProxyInterface) object).realmGet$isReady());
   Table.nativeSetBoolean(
       tableNativePtr,
       columnInfo.mCompletedIndex,
       rowIndex,
       ((BooleansRealmProxyInterface) object).realmGet$mCompleted());
   Table.nativeSetBoolean(
       tableNativePtr,
       columnInfo.anotherBooleanIndex,
       rowIndex,
       ((BooleansRealmProxyInterface) object).realmGet$anotherBoolean());
   return rowIndex;
 }