private Collection<Team> deserializeTeams(JsonArray jsonTeams) { Collection<Team> teams = new ArrayList<>(); for (JsonElement element : jsonTeams) { JsonObject jsonTeam = element.getAsJsonObject(); Team team = null; try { team = teamHelper.read(jsonTeam.get("id").getAsString()); } catch (TeamException e) { Log.e(LOG_NAME, "Error reading user from database", e); } if (team == null) { team = teamDeserializer.fromJson(jsonTeam.toString(), Team.class); } if (team != null) { teams.add(team); } } return teams; }
public EventsDeserializer(Context context) { teamHelper = TeamHelper.getInstance(context); teamDeserializer = TeamDeserializer.getGsonBuilder(); eventDeserializer = EventDeserializer.getGsonBuilder(); }