public static synchronized void dispose() { checkInitialization(); closeDatabase(); sEntities = null; sModelInfo = null; sDatabaseHelper = null; sIsInitialized = false; Log.v("ActiveAndroid disposed. Call initialize to use library."); }
public static synchronized Model getEntity(Class<? extends Model> type, long id) { checkInitialization(); for (Model entity : sEntities) { if (entity != null && entity.getClass() != null && entity.getClass() == type && entity.getId() != null && entity.getId() == id) { return entity; } } return null; }
public static synchronized SQLiteDatabase openDatabase() { if (sDatabaseHelper == null) { checkInitialization(); } return sDatabaseHelper.getWritableDatabase(); }
public static synchronized String getTableName(Class<? extends Model> type) { checkInitialization(); return sModelInfo.getTableInfo(type).getTableName(); }
public static synchronized TypeSerializer getParserForType(Class<?> type) { checkInitialization(); return sModelInfo.getTypeSerializer(type); }
public static synchronized Collection<TableInfo> getTableInfos() { checkInitialization(); return sModelInfo.getTableInfos(); }
public static synchronized void removeEntity(Model entity) { checkInitialization(); sEntities.remove(entity); }
public static synchronized void addEntity(Model entity) { checkInitialization(); sEntities.add(entity); }
public static Context getContext() { checkInitialization(); return sContext; }
public static synchronized void closeDatabase() { checkInitialization(); sDatabaseHelper.close(); }