public static synchronized TableInfo getTableInfo(Class<? extends Model> type) { return sModelInfo.getTableInfo(type); }
public static synchronized Collection<TableInfo> getTableInfos() { return sModelInfo.getTableInfos(); }
public static synchronized TypeSerializer getParserForType(Class<?> type) { return sModelInfo.getTypeSerializer(type); }
public ModelInfo(Configuration configuration) { if (!loadModelFromMetaData(configuration)) { try { scanForModel(configuration.getContext()); } catch (IOException e) { Log.e("Couldn't open source path.", e); } } Log.i("ModelInfo loaded."); }
private void scanForModel(Context context) throws IOException { String packageName = context.getPackageName(); String sourcePath = context.getApplicationInfo().sourceDir; List<String> paths = new ArrayList<String>(); if (sourcePath != null && !(new File(sourcePath).isDirectory())) { DexFile dexfile = new DexFile(sourcePath); Enumeration<String> entries = dexfile.entries(); while (entries.hasMoreElements()) { paths.add(entries.nextElement()); } } // Robolectric fallback else { ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); Enumeration<URL> resources = classLoader.getResources(""); while (resources.hasMoreElements()) { String path = resources.nextElement().getFile(); if (path.contains("bin") || path.contains("classes")) { paths.add(path); } } } for (String path : paths) { File file = new File(path); scanForModelClasses(file, packageName, context.getClassLoader()); } }
public static synchronized void initialize(Configuration configuration) { if (sIsInitialized) { Log.v("ActiveAndroid already initialized."); return; } sContext = configuration.getContext(); sModelInfo = new ModelInfo(configuration); sDatabaseHelper = new DatabaseHelper(configuration); // TODO: It would be nice to override sizeOf here and calculate the memory // actually used, however at this point it seems like the reflection // required would be too costly to be of any benefit. We'll just set a max // object size instead. sEntities = new LruCache<String, Model>(configuration.getCacheSize()); openDatabase(); sIsInitialized = true; Log.v("ActiveAndroid initialized successfully."); }
public ModelInfo(Configuration configuration) { if (!loadModelFromMetaData(configuration)) { try { scanForModel(configuration.getContext()); } catch (IOException e) { Log.e("Couldn't open source path.", e); } } Log.i("ModelInfo loaded."); }
private void scanForModel(Context context) throws IOException { String packageName = context.getPackageName(); String sourcePath = context.getApplicationInfo().sourceDir; List<String> paths = new ArrayList<String>(); if (sourcePath != null && !(new File(sourcePath).isDirectory())) { DexFile dexfile = new DexFile(sourcePath); Enumeration<String> entries = dexfile.entries(); while (entries.hasMoreElements()) { paths.add(entries.nextElement()); } } // Robolectric fallback else { ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); Enumeration<URL> resources = classLoader.getResources(""); while (resources.hasMoreElements()) { String path = resources.nextElement().getFile(); if (path.contains("bin") || path.contains("classes")) { paths.add(path); } } } for (String path : paths) { File file = new File(path); scanForModelClasses(file, packageName, context.getClassLoader()); } }
public static synchronized void initialize(Configuration configuration) { if (sIsInitialized) { Log.v("ActiveAndroid already initialized."); return; } sContext = configuration.getContext(); sModelInfo = new ModelInfo(configuration); sDatabaseHelper = new DatabaseHelper(configuration); // TODO: It would be nice to override sizeOf here and calculate the memory // actually used, however at this point it seems like the reflection // required would be too costly to be of any benefit. We'll just set a max // object size instead. sEntities = new LruCache<String, Model>(configuration.getCacheSize()); openDatabase(); sIsInitialized = true; Log.v("ActiveAndroid initialized successfully."); }
public ModelInfo(Configuration configuration) { if (!loadModelFromMetaData(configuration)) { try { scanForModel(configuration.getContext()); } catch (IOException e) { Log.e("Couldn't open source path.", e); } } Log.i("ModelInfo loaded."); }
public static synchronized TableInfo getTableInfo(Class<? extends Model> type) { return sModelInfo.getTableInfo(type); }
private void scanForModelClasses(File path, String packageName, ClassLoader classLoader) { if (path.isDirectory()) { for (File file : path.listFiles()) { scanForModelClasses(file, packageName, classLoader);
public static synchronized TypeSerializer getParserForType(Class<?> type) { return sModelInfo.getTypeSerializer(type); }
public static synchronized Collection<TableInfo> getTableInfos() { return sModelInfo.getTableInfos(); }
public static synchronized void initialize(Configuration configuration) { if (sIsInitialized) { Log.v("ActiveAndroid already initialized."); return; } sContext = configuration.getContext(); sModelInfo = new ModelInfo(configuration); sDatabaseHelper = new DatabaseHelper(configuration); // TODO: It would be nice to override sizeOf here and calculate the memory // actually used, however at this point it seems like the reflection // required would be too costly to be of any benefit. We'll just set a max // object size instead. sEntities = new LruCache<String, Model>(configuration.getCacheSize()); openDatabase(); sIsInitialized = true; Log.v("ActiveAndroid initialized successfully."); }
public static synchronized String getTableName(Class<? extends Model> type) { return sModelInfo.getTableInfo(type).getTableName(); } }
private void scanForModelClasses(File path, String packageName, ClassLoader classLoader) { if (path.isDirectory()) { for (File file : path.listFiles()) { scanForModelClasses(file, packageName, classLoader);
public static synchronized TypeSerializer getParserForType(Class<?> type) { return sModelInfo.getTypeSerializer(type); }
public static synchronized Collection<TableInfo> getTableInfos() { return sModelInfo.getTableInfos(); }
public static synchronized String getTableName(Class<? extends Model> type) { return sModelInfo.getTableInfo(type).getTableName(); } }