本文整理了Java中com.j256.ormlite.dao.Dao.setObjectFactory()
方法的一些代码示例,展示了Dao.setObjectFactory()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Dao.setObjectFactory()
方法的具体详情如下:
包路径:com.j256.ormlite.dao.Dao
类名称:Dao
方法名:setObjectFactory
[英]Set an object factory so we can wire in controls over an object when it is constructed. Set to null to disable the factory.
[中]设置一个对象工厂,这样我们可以在构建对象时将控件连接到对象上。设置为null以禁用工厂。
代码示例来源:origin: com.j256.ormlite/ormlite-core
/**
* @see Dao#setObjectFactory(ObjectFactory)
*/
@Override
public void setObjectFactory(ObjectFactory<T> objectFactory) {
dao.setObjectFactory(objectFactory);
}
代码示例来源:origin: j256/ormlite-core
/**
* @see Dao#setObjectFactory(ObjectFactory)
*/
@Override
public void setObjectFactory(ObjectFactory<T> objectFactory) {
dao.setObjectFactory(objectFactory);
}
代码示例来源:origin: j256/ormlite-core
@Test
public void testObjectFactory() throws Exception {
Dao<Foo, Object> dao = createDao(Foo.class, true);
FooFactory fooFactory = new FooFactory();
dao.setObjectFactory(fooFactory);
Foo foo = new Foo();
foo.val = 1231;
assertEquals(1, dao.create(foo));
assertEquals(0, fooFactory.fooList.size());
List<Foo> results = dao.queryForAll();
assertEquals(1, results.size());
assertEquals(foo.val, results.get(0).val);
assertEquals(1, fooFactory.fooList.size());
results = dao.queryForAll();
assertEquals(1, results.size());
assertEquals(foo.val, results.get(0).val);
assertEquals(2, fooFactory.fooList.size());
}
内容来源于网络,如有侵权,请联系作者删除!