本文整理汇总了Java中com.couchbase.lite.DatabaseConfiguration类的典型用法代码示例。如果您正苦于以下问题:Java DatabaseConfiguration类的具体用法?Java DatabaseConfiguration怎么用?Java DatabaseConfiguration使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DatabaseConfiguration类属于com.couchbase.lite包,在下文中一共展示了DatabaseConfiguration类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setup
import com.couchbase.lite.DatabaseConfiguration; //导入依赖的package包/类
@Before
public void setup() throws CouchbaseLiteException {
instrumentationCtx = InstrumentationRegistry.getContext();
DatabaseConfiguration config = new DatabaseConfiguration(instrumentationCtx);
mDatabase = new Database("test", config);
}
示例2: testSingletonPattern
import com.couchbase.lite.DatabaseConfiguration; //导入依赖的package包/类
@Test
public void testSingletonPattern() throws CouchbaseLiteException {
// --- code example ---
DataManager mgr = DataManager.instance(new DatabaseConfiguration(/* Android Context*/ context));
// --- code example ---
mgr.delete();
}
示例3: testPreBuiltDatabase
import com.couchbase.lite.DatabaseConfiguration; //导入依赖的package包/类
@Test
public void testPreBuiltDatabase() throws IOException {
// --- code example ---
DatabaseConfiguration config = new DatabaseConfiguration(/* Android Context*/ context);
ZipUtils.unzip(getAsset("replacedb/android200-sqlite.cblite2.zip"), context.getFilesDir());
File path = new File(context.getFilesDir(), "android-sqlite");
try {
Database.copy(path, "travel-sample", config);
} catch (CouchbaseLiteException e) {
Log.e(TAG, "Could not load pre-built database");
}
// --- code example ---
}
示例4: DataManager
import com.couchbase.lite.DatabaseConfiguration; //导入依赖的package包/类
private DataManager(DatabaseConfiguration config) {
try {
database = new Database("dbname", config);
} catch (CouchbaseLiteException e) {
e.printStackTrace();
}
}
示例5: DatabaseManager
import com.couchbase.lite.DatabaseConfiguration; //导入依赖的package包/类
public DatabaseManager(Context context) {
// Set database configuration
try {
// Set Database configuration
DatabaseConfiguration config = new DatabaseConfiguration(context);
File dir = context.getDir("CBL",Context.MODE_PRIVATE);
config.setDirectory(dir);
// Create / Open a database with specified name and configuration
database = new Database(DATABASE_NAME, config);
}
catch (CouchbaseLiteException e) {
e.printStackTrace();
}
}
示例6: instance
import com.couchbase.lite.DatabaseConfiguration; //导入依赖的package包/类
public static DataManager instance(DatabaseConfiguration config) {
if (sharedInstance == null && config != null)
sharedInstance = new DataManager(config);
return sharedInstance;
}