本文整理汇总了Java中com.j256.ormlite.dao.CloseableIterator.next方法的典型用法代码示例。如果您正苦于以下问题:Java CloseableIterator.next方法的具体用法?Java CloseableIterator.next怎么用?Java CloseableIterator.next使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.j256.ormlite.dao.CloseableIterator
的用法示例。
在下文中一共展示了CloseableIterator.next方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: textList
import com.j256.ormlite.dao.CloseableIterator; //导入方法依赖的package包/类
public String textList() {
String result = "";
CloseableIterator<DbRequest> iterator = null;
try {
iterator = MainApp.getDbHelper().getDbRequestInterator();
try {
while (iterator.hasNext()) {
DbRequest dbr = iterator.next();
result += "<br>";
result += dbr.action.toUpperCase() + " ";
result += dbr.collection + ": ";
result += dbr.data;
}
} finally {
iterator.close();
}
} catch (SQLException e) {
log.error("Unhandled exception", e);
}
return result;
}
示例2: getGeometryColumns
import com.j256.ormlite.dao.CloseableIterator; //导入方法依赖的package包/类
/**
* Get the Geometry Columns, should only return one or no value
*
* @return geometry columns
*/
public GeometryColumns getGeometryColumns() {
GeometryColumns result = null;
if (geometryColumns.size() > 1) {
// This shouldn't happen with the unique table name constraint on
// geometry columns
throw new GeoPackageException(
"Unexpected state. More than one GeometryColumn has a foreign key to the Contents. Count: "
+ geometryColumns.size());
} else if (geometryColumns.size() == 1) {
CloseableIterator<GeometryColumns> iterator = geometryColumns
.closeableIterator();
try {
result = iterator.next();
} finally {
try {
iterator.close();
} catch (IOException e) {
throw new GeoPackageException(
"Failed to close the Geometry Columns iterator", e);
}
}
}
return result;
}
示例3: getTileMatrixSet
import com.j256.ormlite.dao.CloseableIterator; //导入方法依赖的package包/类
/**
* Get the Tile Matrix Set, should only return one or no value
*
* @return tile matrix set
*/
public TileMatrixSet getTileMatrixSet() {
TileMatrixSet result = null;
if (tileMatrixSet.size() > 1) {
// This shouldn't happen with the table name primary key on tile
// matrix set
throw new GeoPackageException(
"Unexpected state. More than one TileMatrixSet has a foreign key to the Contents. Count: "
+ tileMatrixSet.size());
} else if (tileMatrixSet.size() == 1) {
CloseableIterator<TileMatrixSet> iterator = tileMatrixSet
.closeableIterator();
try {
result = iterator.next();
} finally {
try {
iterator.close();
} catch (IOException e) {
throw new GeoPackageException(
"Failed to close the Tile Matrix Set iterator", e);
}
}
}
return result;
}
示例4: drawTile
import com.j256.ormlite.dao.CloseableIterator; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public BufferedImage drawTile(int zoom, BoundingBox webMercatorBoundingBox,
CloseableIterator<GeometryIndex> results) {
// Create image and graphics
BufferedImage image = createNewImage();
Graphics2D graphics = getGraphics(image);
// WGS84 to web mercator projection and google shape converter
ProjectionTransform webMercatorTransform = getWebMercatorTransform();
while (results.hasNext()) {
GeometryIndex geometryIndex = results.next();
FeatureRow featureRow = getFeatureIndex().getFeatureRow(
geometryIndex);
drawFeature(zoom, webMercatorBoundingBox, webMercatorTransform,
graphics, featureRow);
}
return image;
}
示例5: testBasic
import com.j256.ormlite.dao.CloseableIterator; //导入方法依赖的package包/类
@Test
public void testBasic() throws Exception {
Dao<MyDouble, Object> dao = createDao(MyDouble.class, true);
MyDouble foo = new MyDouble();
foo.val = 1.23456789123456;
assertEquals(1, dao.create(foo));
MyDouble result = dao.queryForId(foo.id);
assertNotNull(result);
assertEquals(foo.val, result.val, 0.0);
GenericRawResults<String[]> results = dao.queryRaw(dao.queryBuilder().prepareStatementString());
CloseableIterator<String[]> iterator = results.closeableIterator();
try {
assertTrue(iterator.hasNext());
String[] strings = iterator.next();
assertNotNull(strings);
assertTrue(strings.length >= 2);
assertEquals(Integer.toString(foo.id), strings[0]);
assertEquals(Double.toString(foo.val), strings[1]);
} finally {
iterator.close();
}
}
示例6: testCloseInIterator
import com.j256.ormlite.dao.CloseableIterator; //导入方法依赖的package包/类
public void testCloseInIterator() throws Exception {
Dao<Foo, Integer> fooDao = createDao(Foo.class, true);
Foo foo1 = new Foo();
foo1.stuff = "s1";
fooDao.create(foo1);
CloseableIterator<Foo> iterator = fooDao.iterator();
try {
while (iterator.hasNext()) {
iterator.next();
closeConnectionSource();
}
if (!CLOSE_IS_NOOP) {
fail("expected exception");
}
} catch (IllegalStateException e) {
// expected
} finally {
iterator.close();
}
}
示例7: testCloseIteratorBeforeNext
import com.j256.ormlite.dao.CloseableIterator; //导入方法依赖的package包/类
public void testCloseIteratorBeforeNext() throws Exception {
Dao<Foo, Integer> fooDao = createDao(Foo.class, true);
Foo foo1 = new Foo();
foo1.stuff = "s1";
fooDao.create(foo1);
CloseableIterator<Foo> iterator = fooDao.iterator();
try {
while (iterator.hasNext()) {
closeConnectionSource();
iterator.next();
}
if (!CLOSE_IS_NOOP) {
fail("expected exception");
}
} catch (IllegalStateException e) {
// expected
} finally {
iterator.close();
}
}
示例8: testCloseIteratorBeforeRemove
import com.j256.ormlite.dao.CloseableIterator; //导入方法依赖的package包/类
public void testCloseIteratorBeforeRemove() throws Exception {
Dao<Foo, Integer> fooDao = createDao(Foo.class, true);
Foo foo1 = new Foo();
foo1.stuff = "s1";
fooDao.create(foo1);
CloseableIterator<Foo> iterator = fooDao.iterator();
try {
while (iterator.hasNext()) {
iterator.next();
closeConnectionSource();
iterator.remove();
}
if (!CLOSE_IS_NOOP) {
fail("expected exception");
}
} catch (Exception e) {
// expected
} finally {
iterator.close();
}
}
示例9: testIteratePageSize
import com.j256.ormlite.dao.CloseableIterator; //导入方法依赖的package包/类
public void testIteratePageSize() throws Exception {
final Dao<Foo, Integer> fooDao = createDao(Foo.class, true);
int numItems = 1000;
fooDao.callBatchTasks(new InsertCallable(numItems, fooDao));
// now delete them with the iterator to test page-size
CloseableIterator<Foo> iterator = fooDao.iterator();
try {
while (iterator.hasNext()) {
iterator.next();
iterator.remove();
}
} finally {
iterator.close();
}
}
示例10: testEnumToStringValue
import com.j256.ormlite.dao.CloseableIterator; //导入方法依赖的package包/类
@Test
public void testEnumToStringValue() throws Exception {
Class<LocalEnumToString> clazz = LocalEnumToString.class;
Dao<LocalEnumToString, Object> dao = createDao(clazz, true);
LocalEnumToString foo = new LocalEnumToString();
foo.ourEnum = OurEnum.SECOND;
assertEquals(1, dao.create(foo));
GenericRawResults<String[]> results = dao.queryRaw("select * from " + TABLE_NAME);
CloseableIterator<String[]> iterator = results.closeableIterator();
try {
assertTrue(iterator.hasNext());
String[] result = iterator.next();
assertNotNull(result);
assertEquals(1, result.length);
assertFalse(OurEnum.SECOND.name().equals(result[0]));
assertTrue(OurEnum.SECOND.toString().equals(result[0]));
} finally {
IOUtils.closeQuietly(iterator);
}
}
示例11: testIterator
import com.j256.ormlite.dao.CloseableIterator; //导入方法依赖的package包/类
@Test
public void testIterator() throws Exception {
Dao<Foo, Integer> dao = createDao(Foo.class, true);
CloseableIterator<Foo> iterator = dao.iterator();
assertFalse(iterator.hasNext());
Foo foo1 = new Foo();
assertEquals(1, dao.create(foo1));
Foo foo2 = new Foo();
assertEquals(1, dao.create(foo2));
iterator = dao.iterator();
assertTrue(iterator.hasNext());
Foo result = iterator.next();
assertEquals(foo1.id, result.id);
assertTrue(iterator.hasNext());
result = iterator.next();
assertEquals(foo2.id, result.id);
assertFalse(iterator.hasNext());
assertNull(iterator.nextThrow());
}
示例12: testIteratorPrepared
import com.j256.ormlite.dao.CloseableIterator; //导入方法依赖的package包/类
@Test
public void testIteratorPrepared() throws Exception {
Dao<Foo, Integer> dao = createDao(Foo.class, true);
Foo foo1 = new Foo();
assertEquals(1, dao.create(foo1));
Foo foo2 = new Foo();
assertEquals(1, dao.create(foo2));
PreparedQuery<Foo> query = dao.queryBuilder().where().eq(Foo.ID_COLUMN_NAME, foo2.id).prepare();
CloseableIterator<Foo> iterator = dao.iterator(query);
assertTrue(iterator.hasNext());
Foo result = iterator.next();
assertEquals(foo2.id, result.id);
assertFalse(iterator.hasNext());
assertNull(iterator.nextThrow());
}
示例13: testIteratorNextRemoveRemoveNoNext
import com.j256.ormlite.dao.CloseableIterator; //导入方法依赖的package包/类
@Test(expected = IllegalStateException.class)
public void testIteratorNextRemoveRemoveNoNext() throws Exception {
Dao<Foo, Object> dao = createDao(Foo.class, true);
Foo foo1 = new Foo();
assertEquals(1, dao.create(foo1));
Foo foo2 = new Foo();
assertEquals(1, dao.create(foo2));
CloseableIterator<Foo> iterator = dao.iterator();
try {
iterator.next();
iterator.remove();
iterator.remove();
} finally {
iterator.close();
}
}
示例14: testIteratorRemove
import com.j256.ormlite.dao.CloseableIterator; //导入方法依赖的package包/类
@Test
public void testIteratorRemove() throws Exception {
Dao<Foo, Integer> dao = createDao(Foo.class, true);
Foo foo1 = new Foo();
assertEquals(1, dao.create(foo1));
assertEquals(1, dao.queryForAll().size());
CloseableIterator<Foo> iterator = dao.iterator();
assertTrue(iterator.hasNext());
Foo result = iterator.next();
assertEquals(foo1.id, result.id);
iterator.remove();
assertFalse(iterator.hasNext());
assertNull(iterator.nextThrow());
assertEquals(0, dao.queryForAll().size());
iterator.close();
}
示例15: testIteratorHasNextClosed
import com.j256.ormlite.dao.CloseableIterator; //导入方法依赖的package包/类
@Test
public void testIteratorHasNextClosed() throws Exception {
Dao<Foo, Integer> dao = createDao(Foo.class, true);
Foo foo1 = new Foo();
assertEquals(1, dao.create(foo1));
assertEquals(1, dao.queryForAll().size());
CloseableIterator<Foo> iterator = dao.iterator();
assertTrue(iterator.hasNext());
iterator.next();
assertFalse(iterator.hasNext());
assertNull(iterator.nextThrow());
iterator.close();
assertFalse(iterator.hasNext());
}