// Path: library/src/main/java/com/thefinestartist/royal/listener/OnRoyalListener.java
// public abstract class OnRoyalListener {
//     public void onUpdated() {}
//     public void onDeleted() {}
// }
// 
// Path: library/src/main/java/io/realm/RoyalAccess.java
// public class RoyalAccess {
// 
//     public static Realm getRealm(@NonNull RealmObject object) {
//         return object.realm;
//     }
// 
//     public static Row getRow(@NonNull RealmObject object) {
//         return object.row;
//     }
// 
//     public static Table getTable(@NonNull RealmObject object) {
//         return object.row == null ? null : object.row.getTable();
//     }
// 
//     public static boolean isProxy(@NonNull RealmObject object) {
//         return object instanceof RealmObjectProxy;
//     }
// 
//     public static boolean hasPrimaryKey(@NonNull Realm realm, @NonNull RealmObject object) {
//         return realm.getTable(object.getClass()).hasPrimaryKey();
//     }
// 
//     public static Class<? extends RealmObject> getClass(@NonNull Realm realm, @NonNull Table table) {
//         List<Class<? extends RealmObject>> classes = realm.getConfiguration().getSchemaMediator().getModelClasses();
//         for (Class<? extends RealmObject> clazz : classes)
//             if (realm.getTable(clazz).getName().equals(table.getName()))
//                 return clazz;
// 
//         return null;
//     }
// 
//     public static RealmObject get(@NonNull Realm realm, @NonNull Table table, long rowIndex) {
//         if (rowIndex < 0)
//             return null;
// 
//         UncheckedRow row = table.getUncheckedRow(rowIndex);
//         RealmObject result = realm.getConfiguration().getSchemaMediator().newInstance(getClass(realm, table));
//         result.row = row;
//         result.realm = realm;
//         return result;
//     }
// 
//     // TODO: Free RealmObject from Realm
// 
// 
//     // TODO: Clone RealmObject without Realm information
//     // TODO: Problem #1 Serializing RealmObject has same speed of just committing it using Realm
// 
// }


import android.os.AsyncTask;
import android.support.annotation.NonNull;
import com.thefinestartist.royal.listener.OnRoyalListener;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import io.realm.Realm;
import io.realm.RealmConfiguration;
import io.realm.RealmObject;
import io.realm.RoyalAccess;
import io.realm.exceptions.RealmException;
package com.thefinestartist.royal;





/**
 * Created by TheFinestArtist on 7/5/15.
 */
public class RoyalTransaction {

    enum Type {CREATE, CREATE_OR_UPDATE, DELETE}

    // TODO: Support List<? extends RealmObject>, RealmResults
    // Support RealmObject, List, RealmList, RealmResults
    public static void create(Class<? extends RoyalDatabase> clazz, Object... objects) {
        create(Royal.getConfigurationOf(clazz), objects);
    }

    public static void create(@NonNull RealmConfiguration configuration, Object... objects) {
        create(Realm.getInstance(configuration), objects);
    }

    public static void create(@NonNull Realm realm, Object... objects) {
        crud(Type.CREATE, realm, objects);
    }

    public static void save(Class<? extends RoyalDatabase> clazz, Object... objects) {
        save(Royal.getConfigurationOf(clazz), objects);
    }

    public static void save(@NonNull RealmConfiguration configuration, Object... objects) {
// Path: library/src/main/java/com/thefinestartist/royal/listener/OnRoyalListener.java
// public abstract class OnRoyalListener {
//     public void onUpdated() {}
//     public void onDeleted() {}
// }
// 
// Path: library/src/main/java/io/realm/RoyalAccess.java
// public class RoyalAccess {
// 
//     public static Realm getRealm(@NonNull RealmObject object) {
//         return object.realm;
//     }
// 
//     public static Row getRow(@NonNull RealmObject object) {
//         return object.row;
//     }
// 
//     public static Table getTable(@NonNull RealmObject object) {
//         return object.row == null ? null : object.row.getTable();
//     }
// 
//     public static boolean isProxy(@NonNull RealmObject object) {
//         return object instanceof RealmObjectProxy;
//     }
// 
//     public static boolean hasPrimaryKey(@NonNull Realm realm, @NonNull RealmObject object) {
//         return realm.getTable(object.getClass()).hasPrimaryKey();
//     }
// 
//     public static Class<? extends RealmObject> getClass(@NonNull Realm realm, @NonNull Table table) {
//         List<Class<? extends RealmObject>> classes = realm.getConfiguration().getSchemaMediator().getModelClasses();
//         for (Class<? extends RealmObject> clazz : classes)
//             if (realm.getTable(clazz).getName().equals(table.getName()))
//                 return clazz;
// 
//         return null;
//     }
// 
//     public static RealmObject get(@NonNull Realm realm, @NonNull Table table, long rowIndex) {
//         if (rowIndex < 0)
//             return null;
// 
//         UncheckedRow row = table.getUncheckedRow(rowIndex);
//         RealmObject result = realm.getConfiguration().getSchemaMediator().newInstance(getClass(realm, table));
//         result.row = row;
//         result.realm = realm;
//         return result;
//     }
// 
//     // TODO: Free RealmObject from Realm
// 
// 
//     // TODO: Clone RealmObject without Realm information
//     // TODO: Problem #1 Serializing RealmObject has same speed of just committing it using Realm
// 
// }


// Path: library/src/main/java/com/thefinestartist/royal/RoyalTransaction.java
import android.os.AsyncTask;
import android.support.annotation.NonNull;
import com.thefinestartist.royal.listener.OnRoyalListener;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import io.realm.Realm;
import io.realm.RealmConfiguration;
import io.realm.RealmObject;
import io.realm.RoyalAccess;
import io.realm.exceptions.RealmException;

package com.thefinestartist.royal;





/**
 * Created by TheFinestArtist on 7/5/15.
 */
public class RoyalTransaction {

    enum Type {CREATE, CREATE_OR_UPDATE, DELETE}

    // TODO: Support List<? extends RealmObject>, RealmResults
    // Support RealmObject, List, RealmList, RealmResults
    public static void create(Class<? extends RoyalDatabase> clazz, Object... objects) {
        create(Royal.getConfigurationOf(clazz), objects);
    }

    public static void create(@NonNull RealmConfiguration configuration, Object... objects) {
        create(Realm.getInstance(configuration), objects);
    }

    public static void create(@NonNull Realm realm, Object... objects) {
        crud(Type.CREATE, realm, objects);
    }

    public static void save(Class<? extends RoyalDatabase> clazz, Object... objects) {
        save(Royal.getConfigurationOf(clazz), objects);
    }

    public static void save(@NonNull RealmConfiguration configuration, Object... objects) {
        save(Realm.getInstance(configuration), objects);