Exemplo n.º 1
0
 private void parseHourlyWeather(
     JsonReader reader, ForecastReport forecastReport, boolean isSendReponse) throws Exception {
   HashMap<String, String> mappings = new HashMap<>();
   mappings.put("hourly_forecast", "");
   mappings.put("FCTTIME", "");
   mappings.put("hour_padded", "setHour");
   mappings.put("min", "setMinute");
   mappings.put("year", "setYear");
   mappings.put("mon_padded", "setMonth");
   mappings.put("mday_padded", "setDay");
   mappings.put("temp", "");
   mappings.put("temp.english", "setHighTempEnglish");
   mappings.put("temp.metric", "setHighTempMetric");
   mappings.put("dewpoint", "");
   mappings.put("dewpoint.english", "setLowTempEnglish");
   mappings.put("dewpoint.metric", "setLowTempMetric");
   mappings.put("feelslike", "");
   mappings.put("feelslike.english", "setFeelslikeTempEnglish");
   mappings.put("feelslike.metric", "setFeelslikeTempMetric");
   mappings.put("snow", "");
   mappings.put("snow.english", "setSnowEnglish");
   mappings.put("snow.metric", "setSnowMetric");
   mappings.put("condition", "setConditions");
   mappings.put("humidity", "setHumidity");
   mappings.put("icon_url", "setIconUrl");
   mappings.put("response", "");
   mappings.put("error", "");
   mappings.put("error.description", "break");
   ArrayList errors = new ArrayList();
   Util.readJsonToObject(
       reader, "", mappings, new HourWeatherVO(), forecastReport.hourlyWeatherList, errors);
   sendResponse(forecastReport, errors, true, isSendReponse);
 }
Exemplo n.º 2
0
 private void parseDailyWeather(
     JsonReader reader, ForecastReport forecastReport, boolean isSendReponse) throws Exception {
   HashMap<String, String> mappings = new HashMap<>();
   mappings.put("low", "setLowTemp");
   mappings.put("high", "setHighTemp");
   mappings.put("text", "setConditions");
   mappings.put("date", "setDate");
   mappings.put("day", "setDayOfWeek");
   mappings.put("query", "");
   mappings.put("results", "");
   mappings.put("channel", "");
   mappings.put("item", "");
   mappings.put("forecast", "");
   reader.setLenient(true);
   ArrayList errors = new ArrayList();
   Util.readJsonToObject(
       reader, "", mappings, new DayWeatherVO(), forecastReport.dailyWeatherList, errors);
   sendResponse(forecastReport, errors, true, isSendReponse);
 }