package com.tenlionsoft.baselib.core.db;

import android.content.Context;

import com.tenlionsoft.baselib.utils.Utils;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

/**
 * 作者 : Adam on 2018/10/26.
 * 邮箱 : itgaojian@163.com
 * 描述 : 数据库初始化
 */
public class DataBaseHelper {
    /**
     * 反射初始化联系人数据库
     */
    public static void initContactsDB() {
        try {
            Class<?> dbUtils = Class.forName("com.tenlionsoft.modulechat.db.DBUtils");
            Object o = dbUtils.newInstance();
            Method method = dbUtils.getMethod("initial", Context.class);
            method.invoke(o, Utils.getApp());
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        } catch (NoSuchMethodException e) {
            e.printStackTrace();
        } catch (IllegalAccessException e) {
            e.printStackTrace();
        } catch (InvocationTargetException e) {
            e.printStackTrace();
        } catch (InstantiationException e) {
            e.printStackTrace();
        }
    }
}
