@Override
 public LeagueRound fromCursor(SimpleCursor cursor, ElifutPersistenceService service) {
   List<Integer> matchIds =
       Lists.transform(Arrays.asList(cursor.getString("matches").split(",")), Integer::valueOf);
   List<? extends Match> matches = service.query(AutoValueClasses.MATCH, Ints.toArray(matchIds));
   return LeagueRound.create(
       cursor.getInt("id"), cursor.getInt("round_number"), listSupertype(matches));
 }
Example #2
0
 @Override
 public Match fromCursor(SimpleCursor cursor, ElifutDataStore service) {
   Club home = checkNotNull(service.queryOne(AutoValueClasses.CLUB, cursor.getInt("home_id")));
   Club away = checkNotNull(service.queryOne(AutoValueClasses.CLUB, cursor.getInt("away_id")));
   Persistable.Converter<MatchResult> converter =
       service.converterForType(AutoValueClasses.MATCH_RESULT);
   MatchResult matchResult = converter.fromCursor(cursor, service);
   return Match.create(cursor.getInt("id"), home, away, matchResult);
 }
Example #3
0
 @Override
 public MatchResult fromCursor(SimpleCursor cursor, ElifutDataStore service) {
   try {
     String result = cursor.getString("result");
     if (result != null) {
       return adapter.fromJson(result);
     }
   } catch (IOException e) {
     throw new RuntimeException(e);
   }
   return null;
 }