本文整理匯總了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;
}