本文整理汇总了Java中nl.qbusict.cupboard.CupboardBuilder类的典型用法代码示例。如果您正苦于以下问题:Java CupboardBuilder类的具体用法?Java CupboardBuilder怎么用?Java CupboardBuilder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CupboardBuilder类属于nl.qbusict.cupboard包,在下文中一共展示了CupboardBuilder类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: provideCupboard
import nl.qbusict.cupboard.CupboardBuilder; //导入依赖的package包/类
@Provides @Singleton
Cupboard provideCupboard() {
Cupboard cupboard = new CupboardBuilder()
.registerFieldConverter(Intent.class, new IntentFieldConverter())
.registerFieldConverter(Uri.class, new UriFieldConverter())
.build();
cupboard.register(Artwork.class);
return cupboard;
}
开发者ID:tasomaniac,项目名称:MuzeiHistory,代码行数:11,代码来源:DataModule.java
示例2: testAnnotatedEntity
import nl.qbusict.cupboard.CupboardBuilder; //导入依赖的package包/类
public void testAnnotatedEntity() {
Cupboard cupboard = new Cupboard();
cupboard.register(TestAnnotatedEntity.class);
Cupboard annotatedCupboard = new CupboardBuilder().useAnnotations().build();
annotatedCupboard.register(TestAnnotatedEntity.class);
ReflectiveEntityConverter<TestAnnotatedEntity> converter = new ReflectiveEntityConverter<TestAnnotatedEntity>(cupboard, TestAnnotatedEntity.class);
ReflectiveEntityConverter<TestAnnotatedEntity> annotatedConverter = new ReflectiveEntityConverter<TestAnnotatedEntity>(annotatedCupboard, TestAnnotatedEntity.class);
MatrixCursor cursor = new MatrixCursor(new String[]{"_id", "myStringValue", "data1"});
cursor.addRow(new Object[]{1L, "test", "test2"});
cursor.moveToPosition(0);
TestAnnotatedEntity entity = converter.fromCursor(TestHelper.newPreferredColumnOrderCursorWrapper(cursor, converter.getColumns()));
assertEquals(1L, entity._id.longValue());
assertEquals("test", entity.myStringValue);
assertNull(entity.renamedStringValue);
entity = annotatedConverter.fromCursor(TestHelper.newPreferredColumnOrderCursorWrapper(cursor, annotatedConverter.getColumns()));
assertEquals(1L, entity._id.longValue());
assertEquals("test", entity.myStringValue);
assertEquals("test2", entity.renamedStringValue);
ContentValues values = new ContentValues();
annotatedConverter.toValues(entity, values);
assertTrue(values.containsKey("data1"));
assertEquals("test2", values.getAsString("data1"));
assertTrue(values.containsKey("_id"));
assertTrue(values.containsKey("myStringValue"));
}
开发者ID:electrolobzik,项目名称:cupboard,代码行数:30,代码来源:ReflectiveConverterTest.java
示例3: testIgnoreAnnotation
import nl.qbusict.cupboard.CupboardBuilder; //导入依赖的package包/类
public void testIgnoreAnnotation() {
Cupboard cupboard = new Cupboard();
cupboard.register(TestAnnotatedEntity.class);
Cupboard annotatedCupboard = new CupboardBuilder().useAnnotations().build();
annotatedCupboard.register(TestAnnotatedEntity.class);
ReflectiveEntityConverter<TestAnnotatedEntity> converter = new ReflectiveEntityConverter<TestAnnotatedEntity>(cupboard, TestAnnotatedEntity.class);
ReflectiveEntityConverter<TestAnnotatedEntity> annotatedConverter = new ReflectiveEntityConverter<TestAnnotatedEntity>(annotatedCupboard, TestAnnotatedEntity.class);
assertEquals(4, converter.getColumns().size());
assertEquals(3, annotatedConverter.getColumns().size());
}
开发者ID:electrolobzik,项目名称:cupboard,代码行数:14,代码来源:ReflectiveConverterTest.java
示例4: setUp
import nl.qbusict.cupboard.CupboardBuilder; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
cupboard = new CupboardBuilder().build();
cupboard.register(TestEntity.class);
InstrumentationRegistry.getTargetContext().deleteDatabase(TEST_DATABASE);
db = new TestDbHelper(InstrumentationRegistry.getTargetContext(), cupboard, TEST_DATABASE).getWritableDatabase();
rxDatabase = RxCupboard.with(cupboard, db);
// Enable strict mode to test if the underlying database cursors are correctly closed
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder().detectLeakedClosableObjects().penaltyLog().penaltyDeath().build());
}
// Insert 10 rows in the TestEntity table
Flowable.range(1, 10)
.map(new Function<Integer, TestEntity>() {
@Override
public TestEntity apply(Integer integer) throws Exception {
TestEntity testEntity = new TestEntity();
testEntity._id = integer.longValue();
testEntity.string = "Test";
testEntity.time = integer.longValue();
return testEntity;
}
})
.doOnNext(rxDatabase.<TestEntity>put())
.test();
accumulator = new BiFunction<Integer, TestEntity, Integer>() {
@Override
public Integer apply(Integer count, TestEntity testEntity) throws Exception {
return count + 1;
}
};
}
开发者ID:erickok,项目名称:RxCupboard,代码行数:36,代码来源:QueryTest.java
示例5: setUp
import nl.qbusict.cupboard.CupboardBuilder; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
Cupboard cupboard = new CupboardBuilder().build();
cupboard.register(TestEntity.class);
InstrumentationRegistry.getTargetContext().deleteDatabase(TEST_DATABASE);
db = new TestDbHelper(InstrumentationRegistry.getTargetContext(), cupboard, TEST_DATABASE).getWritableDatabase();
rxDatabase = RxCupboard.with(cupboard, db);
}
开发者ID:erickok,项目名称:RxCupboard,代码行数:9,代码来源:CrudTest.java
示例6: setUp
import nl.qbusict.cupboard.CupboardBuilder; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
Cupboard cupboard = new CupboardBuilder().build();
cupboard.register(TestEntity.class);
cupboard.register(TestEntity2.class);
InstrumentationRegistry.getTargetContext().deleteDatabase(TEST_DATABASE);
db = new TestDbHelper(InstrumentationRegistry.getTargetContext(), cupboard, TEST_DATABASE).getWritableDatabase();
rxDatabase = RxCupboard.with(cupboard, db);
}
开发者ID:erickok,项目名称:RxCupboard,代码行数:10,代码来源:ChangesTest.java
示例7: getInstance
import nl.qbusict.cupboard.CupboardBuilder; //导入依赖的package包/类
public static Cupboard getInstance() {
if (cupboard == null) {
cupboard = new CupboardBuilder().build();
}
return cupboard;
}
开发者ID:jgilfelt,项目名称:chuck,代码行数:7,代码来源:LocalCupboard.java
示例8: getAnnotatedInstance
import nl.qbusict.cupboard.CupboardBuilder; //导入依赖的package包/类
public static Cupboard getAnnotatedInstance() {
return new CupboardBuilder(getInstance())
.useAnnotations()
.build();
}
开发者ID:jgilfelt,项目名称:chuck,代码行数:6,代码来源:LocalCupboard.java
示例9: setUpCupboard
import nl.qbusict.cupboard.CupboardBuilder; //导入依赖的package包/类
private void setUpCupboard() {
cupboard = new CupboardBuilder().useAnnotations().build();
}
开发者ID:greenrobot,项目名称:android-database-performance,代码行数:4,代码来源:PerfTestCupboard.java
示例10: setUp
import nl.qbusict.cupboard.CupboardBuilder; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
cupboard = new CupboardBuilder().useAnnotations().build();
cupboard.register(Contact.class);
}
开发者ID:erickok,项目名称:RxCupboard,代码行数:6,代码来源:ContentProviderTest.java
示例11: setUp
import nl.qbusict.cupboard.CupboardBuilder; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
cupboard = new CupboardBuilder().build();
cupboard.register(TestEntity.class);
InstrumentationRegistry.getTargetContext().deleteDatabase(TEST_DATABASE);
}
开发者ID:erickok,项目名称:RxCupboard,代码行数:7,代码来源:CursorTest.java
注:本文中的nl.qbusict.cupboard.CupboardBuilder类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论