// Path: droitatedDB/src/main/java/org/droitateddb/schema/EntityInfo.java
// public class EntityInfo {
//     private final String tableName;
//     private final String className;
//     private final Class<?> definition;
//     private final boolean validation;
// 
//     public EntityInfo(final String className, final String tableName, final Class<?> definition) {
//         this.className = className;
//         this.tableName = tableName;
//         this.definition = definition;
//         this.validation = false;
//     }
// 
//     public EntityInfo(final String className, final String tableName, final Class<?> definition, final boolean validation) {
//         this.className = className;
//         this.tableName = tableName;
//         this.definition = definition;
//         this.validation = validation;
//     }
// 
//     public String className() {
//         return className;
//     }
// 
//     public String table() {
//         return tableName;
//     }
// 
//     public Class<?> definition() {
//         return definition;
//     }
// 
//     public boolean hasValidation() {
//         return validation;
//     }
// }
// 
// Path: droitatedDB/src/main/java/org/droitateddb/Utilities.java
// static <T> T getFieldValue(Class<?> aClass, String fieldName, Object data) {
//     return getFieldValue(data, getDeclaredField(aClass, fieldName));
// }


import java.util.Collection;
import java.util.List;
import static org.droitateddb.Utilities.getFieldValue;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import org.droitateddb.cursor.CombinedCursorImpl;
import org.droitateddb.entity.Column;
import org.droitateddb.entity.Entity;
import org.droitateddb.entity.PrimaryKey;
import org.droitateddb.schema.EntityInfo;
import org.droitateddb.validation.AccumulatedValidationResult;
import org.droitateddb.validation.InvalidEntityException;
import org.droitateddb.validation.ValidationToggle;
import java.lang.reflect.Field;
import java.util.ArrayList;
/*
 * Copyright (C) 2014 The droitated DB Authors
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.droitateddb;





/**
 * Provides support for executing CRUD operations on {@link org.droitateddb.entity.Entity} classes, such getting them from the database or
 * saving them to the database.<br>
 * <br>
 * Each operation opens a connection to the {@link SQLiteDatabase}. If you want only one db connection use
 * {@link ConnectedEntityService}
 *
 * @param <E> Entity, for which this service will be used
 * @author Falk Appel
 * @author Alexander Frank
 */
public class EntityService<E> {
    private final Context context;
    private final Class<E> entityClass;
    private String tableName;
// Path: droitatedDB/src/main/java/org/droitateddb/schema/EntityInfo.java
// public class EntityInfo {
//     private final String tableName;
//     private final String className;
//     private final Class<?> definition;
//     private final boolean validation;
// 
//     public EntityInfo(final String className, final String tableName, final Class<?> definition) {
//         this.className = className;
//         this.tableName = tableName;
//         this.definition = definition;
//         this.validation = false;
//     }
// 
//     public EntityInfo(final String className, final String tableName, final Class<?> definition, final boolean validation) {
//         this.className = className;
//         this.tableName = tableName;
//         this.definition = definition;
//         this.validation = validation;
//     }
// 
//     public String className() {
//         return className;
//     }
// 
//     public String table() {
//         return tableName;
//     }
// 
//     public Class<?> definition() {
//         return definition;
//     }
// 
//     public boolean hasValidation() {
//         return validation;
//     }
// }
// 
// Path: droitatedDB/src/main/java/org/droitateddb/Utilities.java
// static <T> T getFieldValue(Class<?> aClass, String fieldName, Object data) {
//     return getFieldValue(data, getDeclaredField(aClass, fieldName));
// }


// Path: droitatedDB/src/main/java/org/droitateddb/EntityService.java
import java.util.Collection;
import java.util.List;
import static org.droitateddb.Utilities.getFieldValue;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import org.droitateddb.cursor.CombinedCursorImpl;
import org.droitateddb.entity.Column;
import org.droitateddb.entity.Entity;
import org.droitateddb.entity.PrimaryKey;
import org.droitateddb.schema.EntityInfo;
import org.droitateddb.validation.AccumulatedValidationResult;
import org.droitateddb.validation.InvalidEntityException;
import org.droitateddb.validation.ValidationToggle;
import java.lang.reflect.Field;
import java.util.ArrayList;

/*
 * Copyright (C) 2014 The droitated DB Authors
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.droitateddb;





/**
 * Provides support for executing CRUD operations on {@link org.droitateddb.entity.Entity} classes, such getting them from the database or
 * saving them to the database.<br>
 * <br>
 * Each operation opens a connection to the {@link SQLiteDatabase}. If you want only one db connection use
 * {@link ConnectedEntityService}
 *
 * @param <E> Entity, for which this service will be used
 * @author Falk Appel
 * @author Alexander Frank
 */
public class EntityService<E> {
    private final Context context;
    private final Class<E> entityClass;
    private String tableName;
    private final EntityInfo entityInfo;