本文整理匯總了Java中com.orm.SugarRecord.findAsIterator方法的典型用法代碼示例。如果您正苦於以下問題:Java SugarRecord.findAsIterator方法的具體用法?Java SugarRecord.findAsIterator怎麽用?Java SugarRecord.findAsIterator使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.orm.SugarRecord
的用法示例。
在下文中一共展示了SugarRecord.findAsIterator方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: findAsIteratorTest
import com.orm.SugarRecord; //導入方法依賴的package包/類
@Test
public void findAsIteratorTest() throws Exception {
for (int i = 1; i <= 100; i++) {
save(new SimpleExtendedModel());
}
Iterator<SimpleExtendedModel> cursor = SugarRecord.findAsIterator(SimpleExtendedModel.class,
"id >= ?", "50");
for (int i = 50; i <= 100; i++) {
assertTrue(cursor.hasNext());
SimpleExtendedModel model = cursor.next();
assertNotNull(model);
assertEquals(new Long(i), model.getId());
}
}
示例2: findAsIteratorOutOfBoundsTest
import com.orm.SugarRecord; //導入方法依賴的package包/類
@Test(expected=NoSuchElementException.class)
public void findAsIteratorOutOfBoundsTest() throws Exception {
save(new SimpleExtendedModel());
Iterator<SimpleExtendedModel> cursor = SugarRecord.findAsIterator(SimpleExtendedModel.class,
"id = ?", "1");
assertTrue(cursor.hasNext());
SimpleExtendedModel model = cursor.next();
assertNotNull(model);
assertEquals(new Long(1), model.getId());
// This should throw a NoSuchElementException
cursor.next();
}
示例3: disallowRemoveCursorTest
import com.orm.SugarRecord; //導入方法依賴的package包/類
@Test(expected=UnsupportedOperationException.class)
public void disallowRemoveCursorTest() throws Exception {
save(new SimpleExtendedModel());
Iterator<SimpleExtendedModel> cursor = SugarRecord.findAsIterator(SimpleExtendedModel.class,
"id = ?", "1");
assertTrue(cursor.hasNext());
SimpleExtendedModel model = cursor.next();
assertNotNull(model);
assertEquals(new Long(1), model.getId());
// This should throw a UnsupportedOperationException
cursor.remove();
}
示例4: findAsIteratorTest
import com.orm.SugarRecord; //導入方法依賴的package包/類
@Test
public void findAsIteratorTest() throws Exception {
for (int i = 1; i <= 100; i++) {
save(new SimpleAnnotatedModel());
}
Iterator<SimpleAnnotatedModel> cursor = SugarRecord.findAsIterator(SimpleAnnotatedModel.class,
"id >= ?", "50");
for (int i = 50; i <= 100; i++) {
assertTrue(cursor.hasNext());
SimpleAnnotatedModel model = cursor.next();
assertNotNull(model);
assertEquals(new Long(i), model.getId());
}
}
示例5: findAsIteratorOutOfBoundsTest
import com.orm.SugarRecord; //導入方法依賴的package包/類
@Test(expected=NoSuchElementException.class)
public void findAsIteratorOutOfBoundsTest() throws Exception {
save(new SimpleAnnotatedModel());
Iterator<SimpleAnnotatedModel> cursor = SugarRecord.findAsIterator(SimpleAnnotatedModel.class,
"id = ?", "1");
assertTrue(cursor.hasNext());
SimpleAnnotatedModel model = cursor.next();
assertNotNull(model);
assertEquals(new Long(1), model.getId());
// This should throw a NoSuchElementException
cursor.next();
}
示例6: disallowRemoveCursorTest
import com.orm.SugarRecord; //導入方法依賴的package包/類
@Test(expected=UnsupportedOperationException.class)
public void disallowRemoveCursorTest() throws Exception {
save(new SimpleAnnotatedModel());
Iterator<SimpleAnnotatedModel> cursor = SugarRecord.findAsIterator(SimpleAnnotatedModel.class,
"id = ?", "1");
assertTrue(cursor.hasNext());
SimpleAnnotatedModel model = cursor.next();
assertNotNull(model);
assertEquals(new Long(1), model.getId());
// This should throw a UnsupportedOperationException
cursor.remove();
}
示例7: iterator
import com.orm.SugarRecord; //導入方法依賴的package包/類
@Override
public Iterator<T> iterator() {
if (arguments == null) {
arguments = convertArgs(args);
}
return SugarRecord.findAsIterator(record, whereClause, arguments, groupBy, orderBy, limit);
}