コード例 #1
0
  public List<TimeEntry> getByMonth(Month month, RowMapper<TimeEntry> mapper) {
    List<TimeEntry> entries = new ArrayList<>();

    Cursor cursor =
        getDb()
            .query(
                TimeEntryContract.TimeEntry.TABLE_NAME,
                TimeEntryContract.TimeEntry.columns,
                "strftime('%m', date) = ?",
                new String[] {month.numeric()},
                null,
                null,
                "date");

    while (cursor.moveToNext()) {
      TimeEntry timeEntry = mapper.mapRow(cursor);
      entries.add(timeEntry);
    }

    return entries;
  }