Пример #1
0
 private static List<Trackable> parseTrackables(final ArrayNode trackablesJson) {
   if (trackablesJson.size() == 0) {
     return Collections.emptyList();
   }
   final List<Trackable> result = new ArrayList<>();
   for (final JsonNode trackableResponse : trackablesJson) {
     try {
       final Trackable trk = new Trackable();
       trk.setGeocode(trackableResponse.get(TRK_GEOCODE).asText());
       trk.setName(trackableResponse.get(TRK_NAME).asText());
       result.add(trk);
     } catch (final NullPointerException e) {
       Log.e("OkapiClient.parseWaypoints", e);
       // Don't overwrite internal state with possibly partial result
       return null;
     }
   }
   return result;
 }
Пример #2
0
 @Override
 @NonNull
 public String getUrl(@NonNull final Trackable trackable) {
   return getUrl(trackable.getGeocode());
 }
Пример #3
0
 @NonNull
 public static TrackableConnector getConnector(final Trackable trackable) {
   return getTrackableConnector(trackable.getGeocode());
 }