本文整理匯總了Java中com.orm.SugarRecord.findById方法的典型用法代碼示例。如果您正苦於以下問題:Java SugarRecord.findById方法的具體用法?Java SugarRecord.findById怎麽用?Java SugarRecord.findById使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.orm.SugarRecord
的用法示例。
在下文中一共展示了SugarRecord.findById方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: objectLongAnnotatedTest
import com.orm.SugarRecord; //導入方法依賴的package包/類
@Test
public void objectLongAnnotatedTest() {
Long objectLong = new Long(25L);
save(new LongFieldAnnotatedModel(objectLong));
LongFieldAnnotatedModel model = SugarRecord.findById(LongFieldAnnotatedModel.class, 1);
assertEquals(objectLong, model.getLong());
}
示例2: objectShortExtendedTest
import com.orm.SugarRecord; //導入方法依賴的package包/類
@Test
public void objectShortExtendedTest() {
Short objectShort = new Short((short) 25);
save(new ShortFieldExtendedModel(objectShort));
ShortFieldExtendedModel model = SugarRecord.findById(ShortFieldExtendedModel.class, 1);
assertEquals(objectShort, model.getShort());
}
示例3: stringAnnotatedTest
import com.orm.SugarRecord; //導入方法依賴的package包/類
@Test
public void stringAnnotatedTest() {
String string = "Test String";
save(new StringFieldAnnotatedModel(string));
StringFieldAnnotatedModel model = SugarRecord.findById(StringFieldAnnotatedModel.class, 1);
assertEquals(string, model.getString());
}
示例4: findByIdStringsManyTest
import com.orm.SugarRecord; //導入方法依賴的package包/類
@Test
public void findByIdStringsManyTest() throws Exception {
for (int i = 1; i <= 10; i++) {
save(new SimpleExtendedModel());
}
List<SimpleExtendedModel> models =
SugarRecord.findById(SimpleExtendedModel.class, new String[]{"1", "3", "6", "10"});
assertEquals(4, models.size());
assertEquals(new Long(1L), models.get(0).getId());
assertEquals(new Long(3L), models.get(1).getId());
assertEquals(new Long(6L), models.get(2).getId());
assertEquals(new Long(10L), models.get(3).getId());
}
示例5: objectShortAnnotatedTest
import com.orm.SugarRecord; //導入方法依賴的package包/類
@Test
public void objectShortAnnotatedTest() {
Short objectShort = new Short((short) 25);
save(new ShortFieldAnnotatedModel(objectShort));
ShortFieldAnnotatedModel model = SugarRecord.findById(ShortFieldAnnotatedModel.class, 1);
assertEquals(objectShort, model.getShort());
}
示例6: objectFloatExtendedTest
import com.orm.SugarRecord; //導入方法依賴的package包/類
@Test
public void objectFloatExtendedTest() {
Float objectFloat = new Float(25F);
save(new FloatFieldExtendedModel(objectFloat));
FloatFieldExtendedModel model = SugarRecord.findById(FloatFieldExtendedModel.class, 1);
assertEquals(objectFloat, model.getFloat());
}
示例7: objectDoubleAnnotatedTest
import com.orm.SugarRecord; //導入方法依賴的package包/類
@Test
public void objectDoubleAnnotatedTest() {
Double objectDouble = new Double(25.0);
save(new DoubleFieldAnnotatedModel(objectDouble));
DoubleFieldAnnotatedModel model = SugarRecord.findById(DoubleFieldAnnotatedModel.class, 1);
assertEquals(objectDouble, model.getDouble());
}
示例8: integerExtendedTest
import com.orm.SugarRecord; //導入方法依賴的package包/類
@Test
public void integerExtendedTest() {
Integer integer = new Integer(25);
save(new IntegerFieldExtendedModel(integer));
IntegerFieldExtendedModel model = SugarRecord.findById(IntegerFieldExtendedModel.class, 1);
assertEquals(integer, model.getInteger());
}
示例9: stringExtendedTest
import com.orm.SugarRecord; //導入方法依賴的package包/類
@Test
public void stringExtendedTest() {
String string = "Test String";
save(new StringFieldExtendedModel(string));
StringFieldExtendedModel model = SugarRecord.findById(StringFieldExtendedModel.class, 1);
assertEquals(string, model.getString());
}
示例10: firstDeletedRecordAnnotatedTest
import com.orm.SugarRecord; //導入方法依賴的package包/類
@Test
public void firstDeletedRecordAnnotatedTest() {
Float firstObjectFloat = new Float(15F);
Float secondObjectFloat = new Float(25F);
Float thirdObjectFloat = new Float(35F);
Float fourthObjectFloat = new Float(45F);
save(new FloatFieldAnnotatedModel(firstObjectFloat));
save(new FloatFieldAnnotatedModel(secondObjectFloat));
save(new FloatFieldAnnotatedModel(thirdObjectFloat));
save(new FloatFieldAnnotatedModel(fourthObjectFloat));
FloatFieldAnnotatedModel firstRecord = SugarRecord.findById(FloatFieldAnnotatedModel.class, 1);
SugarRecord.delete(firstRecord);
FloatFieldAnnotatedModel model = SugarRecord.first(FloatFieldAnnotatedModel.class);
assertEquals(secondObjectFloat, model.getFloat());
}
示例11: isInDB
import com.orm.SugarRecord; //導入方法依賴的package包/類
@Override
public boolean isInDB(Todo flight) {
return SugarRecord.findById(Todo.class, flight.getId()) != null;
}
示例12: rawBooleanAnnotatedTest
import com.orm.SugarRecord; //導入方法依賴的package包/類
@Test
public void rawBooleanAnnotatedTest() {
save(new BooleanFieldAnnotatedModel(true));
BooleanFieldAnnotatedModel model = SugarRecord.findById(BooleanFieldAnnotatedModel.class, 1);
assertEquals(true, model.getRawBoolean());
}
示例13: nullLongAnnotatedTest
import com.orm.SugarRecord; //導入方法依賴的package包/類
@Test
public void nullLongAnnotatedTest() {
save(new LongFieldAnnotatedModel());
LongFieldAnnotatedModel model = SugarRecord.findById(LongFieldAnnotatedModel.class, 1);
assertNull(model.getLong());
}
示例14: rawFloatExtendedTest
import com.orm.SugarRecord; //導入方法依賴的package包/類
@Test
public void rawFloatExtendedTest() {
save(new FloatFieldExtendedModel(25F));
FloatFieldExtendedModel model = SugarRecord.findById(FloatFieldExtendedModel.class, 1);
assertEquals(25F, model.getRawFloat(), 0.0000000001F);
}
示例15: rawBooleanExtendedTest
import com.orm.SugarRecord; //導入方法依賴的package包/類
@Test
public void rawBooleanExtendedTest() {
save(new BooleanFieldExtendedModel(true));
BooleanFieldExtendedModel model = SugarRecord.findById(BooleanFieldExtendedModel.class, 1);
assertEquals(true, model.getRawBoolean());
}