コード例 #1
0
  public void testCustomIdProperty() {
    Function<Long> idSquared = Function.rawFunction("_id * _id");
    LongProperty idSquaredProperty = LongProperty.fromFunction(idSquared, "idSquared");
    testRecyclerAdapterInternal(
        idSquaredProperty,
        new RecyclerAdapterTest() {

          @Override
          public void testRecyclerAdapter(TestRecyclerAdapter adapter) {
            assertTrue(adapter.hasStableIds());
            assertEquals(1, adapter.getItemId(0));
            assertEquals(4, adapter.getItemId(1));
          }
        });
  }
コード例 #2
0
ファイル: TestViewModelSpec.java プロジェクト: kyling/squidb
@ViewModelSpec(className = "TestViewModel", viewName = "testView")
public class TestViewModelSpec {

  @ViewQuery
  public static final Query QUERY =
      Query.select()
          .from(TestModel.TABLE)
          .join(Join.inner(Employee.TABLE, TestModel.ID.eq(Employee.ID)));

  public static final LongProperty TEST_MODEL_ID = TestModel.ID;

  public static final LongProperty EMPLOYEE_MODEL_ID = Employee.ID;

  public static final StringProperty TEST_NAME = TestModel.FIRST_NAME;

  public static final StringProperty EMPLOYEE_NAME = Employee.NAME;

  public static final StringProperty UPPERCASE_NAME =
      StringProperty.fromFunction(Function.upper(EMPLOYEE_NAME), "uppercase_name");
}