当前位置: 首页>>代码示例>>Java>>正文


Java CloseableIterator.next方法代码示例

本文整理汇总了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;
}
 
开发者ID:MilosKozak,项目名称:AndroidAPS,代码行数:22,代码来源:UploadQueue.java

示例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;
}
 
开发者ID:ngageoint,项目名称:geopackage-core-java,代码行数:30,代码来源:Contents.java

示例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;
}
 
开发者ID:ngageoint,项目名称:geopackage-core-java,代码行数:30,代码来源:Contents.java

示例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;
}
 
开发者ID:ngageoint,项目名称:geopackage-java,代码行数:25,代码来源:DefaultFeatureTiles.java

示例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();
	}
}
 
开发者ID:j256,项目名称:ormlite-tests,代码行数:27,代码来源:SqliteRawRowMapperImplTest.java

示例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();
	}
}
 
开发者ID:j256,项目名称:ormlite-android-tests,代码行数:21,代码来源:AndroidJdbcBaseDaoImplTest.java

示例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();
	}
}
 
开发者ID:j256,项目名称:ormlite-android-tests,代码行数:21,代码来源:AndroidJdbcBaseDaoImplTest.java

示例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();
	}
}
 
开发者ID:j256,项目名称:ormlite-android-tests,代码行数:22,代码来源:AndroidJdbcBaseDaoImplTest.java

示例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();
	}
}
 
开发者ID:j256,项目名称:ormlite-android-tests,代码行数:18,代码来源:AndroidJdbcBaseDaoImplTest.java

示例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);
	}
}
 
开发者ID:j256,项目名称:ormlite-core,代码行数:21,代码来源:EnumToStringTypeTest.java

示例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());
}
 
开发者ID:j256,项目名称:ormlite-core,代码行数:25,代码来源:SelectIteratorTest.java

示例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());
}
 
开发者ID:j256,项目名称:ormlite-core,代码行数:18,代码来源:SelectIteratorTest.java

示例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();
	}
}
 
开发者ID:j256,项目名称:ormlite-core,代码行数:17,代码来源:SelectIteratorTest.java

示例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();
}
 
开发者ID:j256,项目名称:ormlite-core,代码行数:21,代码来源:SelectIteratorTest.java

示例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());
}
 
开发者ID:j256,项目名称:ormlite-core,代码行数:19,代码来源:SelectIteratorTest.java


注:本文中的com.j256.ormlite.dao.CloseableIterator.next方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。