public JSONObject toJSON() {
   JSONObject jsonObject = new JSONObject();
   jsonObject.put("night_or_day", _periodOfTime.toString().toLowerCase());
   jsonObject.put("date", DateUtils.getISO8601String(_date));
   jsonObject.put("icon_code", _iconCode);
   jsonObject.put("icon_uri", _iconURI);
   jsonObject.put("description", _description);
   jsonObject.put("description_long", _descriptionLong);
   jsonObject.put("geography", _geography.toJSON());
   jsonObject.put("units", _units.toString().toLowerCase());
   jsonObject.put("high_temp", _highTemperature);
   jsonObject.put("low_temp", _lowTemperature);
   jsonObject.put("effective_high_temp", _effectiveHighTemperature);
   jsonObject.put("effective_low_temp", _effectiveLowTemperature);
   jsonObject.put("wind_speed", _windSpeed);
   jsonObject.put("wind_gust", _windGust);
   jsonObject.put("wind_direction", _windDirection.toString().toLowerCase());
   jsonObject.put("max_uv", _maxUV);
   jsonObject.put("rain_amount", _rainAmount);
   jsonObject.put("snow_amount", _snowAmount);
   jsonObject.put("ice_amount", _iceAmount);
   jsonObject.put("total_precipitation", _totalPrecipitation);
   jsonObject.put("details_uri", _detailsURI);
   return (jsonObject);
 }
 public JSONObject toJSON() {
   JSONObject jsonObject = new JSONObject();
   if (_service != null) jsonObject.put("service", _service);
   if (_itemID != null) jsonObject.put("service_item_id", _itemID);
   if (_reviewID != null) jsonObject.put("service_review_id", _reviewID);
   jsonObject.put("rating", _rating);
   jsonObject.put("max_rating", _maxRating);
   jsonObject.put("min_rating", _minRating);
   jsonObject.put("votes", _votes);
   jsonObject.put("helpful_votes", _helpfulVotes);
   jsonObject.put("rating_img_url", _ratingImageURI);
   if (_date != null) jsonObject.put("date", DateUtils.getISO8601String(_date));
   jsonObject.put("reviewer_name", _reviewerName);
   jsonObject.put("description", _description);
   jsonObject.put("reviewer_icon_uri", _reviewerIconURI);
   jsonObject.put("review_source_uri", _sourceURI);
   jsonObject.put("review_image_uri", _imageURI);
   return (jsonObject);
 }
 public WeatherForecastVO(JSONObject jsonObject) throws APIProtocolException {
   super();
   if (jsonObject == null) throw new APIProtocolException();
   try {
     _periodOfTime = PeriodOfTime.valueOf(((String) jsonObject.get("night_or_day")).toUpperCase());
   } catch (Exception exception) {
     Debug.displayStack(this, exception, 1);
   }
   try {
     _date = DateUtils.parseISO8601String((String) jsonObject.get("date"));
   } catch (Exception exception) {
     Debug.displayStack(this, exception, 1);
   }
   try {
     _iconCode = (String) jsonObject.get("icon_code");
   } catch (Exception exception) {
     Debug.displayStack(this, exception, 1);
   }
   try {
     _iconURI = (String) jsonObject.get("icon_uri");
   } catch (Exception exception) {
     Debug.displayStack(this, exception, 1);
   }
   try {
     _description = (String) jsonObject.get("description");
   } catch (Exception exception) {
     Debug.displayStack(this, exception, 1);
   }
   try {
     _descriptionLong = (String) jsonObject.get("description_long");
   } catch (Exception exception) {
     Debug.displayStack(this, exception, 1);
   }
   try {
     _geography = new GeographyVO((JSONObject) jsonObject.get("geography"));
   } catch (Exception exception) {
     Debug.displayStack(this, exception, 1);
   }
   try {
     _units = MeasurementSystem.valueOf(((String) jsonObject.get("units")).toUpperCase());
   } catch (Exception exception) {
     Debug.displayStack(this, exception, 1);
   }
   try {
     _scale =
         _units == MeasurementSystem.ENGLISH
             ? TemperatureScale.FAHRENHEIT
             : TemperatureScale.CELSIUS;
   } catch (Exception exception) {
     Debug.displayStack(this, exception, 1);
   }
   try {
     _highTemperature = (Long) jsonObject.get("high_temp");
   } catch (Exception exception) {
     Debug.displayStack(this, exception, 1);
   }
   try {
     _lowTemperature = (Long) jsonObject.get("low_temp");
   } catch (Exception exception) {
     Debug.displayStack(this, exception, 1);
   }
   try {
     _effectiveHighTemperature = (Long) jsonObject.get("effective_high_temp");
   } catch (Exception exception) {
     Debug.displayStack(this, exception, 1);
   }
   try {
     _effectiveLowTemperature = (Long) jsonObject.get("effective_low_temp");
   } catch (Exception exception) {
     Debug.displayStack(this, exception, 1);
   }
   try {
     _windSpeed = (Long) jsonObject.get("wind_speed");
   } catch (Exception exception) {
     Debug.displayStack(this, exception, 1);
   }
   try {
     _windGust = (Long) jsonObject.get("wind_gust");
   } catch (Exception exception) {
     Debug.displayStack(this, exception, 1);
   }
   try {
     _windDirection = CardinalDirection.valueOf((String) jsonObject.get("wind_direction"));
   } catch (Exception exception) {
     Debug.displayStack(this, exception, 1);
   }
   try {
     _maxUV = (String) jsonObject.get("max_uv");
   } catch (Exception exception) {
     Debug.displayStack(this, exception, 1);
   }
   try {
     _rainAmount = (Double) jsonObject.get("rain_amount");
   } catch (Exception exception) {
     Debug.displayStack(this, exception, 1);
   }
   try {
     _snowAmount = (Double) jsonObject.get("snow_amount");
   } catch (Exception exception) {
     Debug.displayStack(this, exception, 1);
   }
   try {
     _iceAmount = (Double) jsonObject.get("ice_amount");
   } catch (Exception exception) {
     Debug.displayStack(this, exception, 1);
   }
   try {
     _totalPrecipitation = (Double) jsonObject.get("total_precipitation");
   } catch (Exception exception) {
     Debug.displayStack(this, exception, 1);
   }
   try {
     _thunderstormProbability = (Long) jsonObject.get("thunderstorm_probability");
   } catch (Exception exception) {
     Debug.displayStack(this, exception, 1);
   }
   try {
     _detailsURI = (String) jsonObject.get("details_uri");
   } catch (Exception exception) {
     Debug.displayStack(this, exception, 1);
   }
 }
 public ReviewVO(JSONObject jsonObject) throws APIProtocolException {
   super();
   try {
     _service = (String) jsonObject.get("service");
   } catch (Exception exception) {
     Debug.displayStack(this, exception);
   }
   try {
     _itemID = (String) jsonObject.get("service_item_id");
   } catch (Exception exception) {
     Debug.displayStack(this, exception);
   }
   try {
     _reviewID = (String) jsonObject.get("service_review_id");
   } catch (Exception exception) {
     Debug.displayStack(this, exception);
   }
   try {
     _rating = Double.parseDouble("" + jsonObject.get("rating"));
   } catch (Exception exception) {
     Debug.displayStack(this, exception);
   }
   try {
     _maxRating = Double.parseDouble("" + jsonObject.get("max_rating"));
   } catch (Exception exception) {
     Debug.displayStack(this, exception);
   }
   try {
     _minRating = Double.parseDouble("" + jsonObject.get("min_rating"));
   } catch (Exception exception) {
     Debug.displayStack(this, exception);
   }
   try {
     _votes = Integer.parseInt("" + jsonObject.get("votes"));
   } catch (Exception exception) {
     Debug.displayStack(this, exception);
   }
   try {
     _helpfulVotes = Integer.parseInt("" + jsonObject.get("helpful_votes"));
   } catch (Exception exception) {
     Debug.displayStack(this, exception);
   }
   try {
     _ratingImageURI = (String) jsonObject.get("rating_img_url");
   } catch (Exception exception) {
     Debug.displayStack(this, exception);
   }
   try {
     _date = DateUtils.parseISO8601String((String) jsonObject.get("date"));
   } catch (Exception exception) {
     Debug.displayStack(this, exception);
   }
   try {
     _reviewerName = (String) jsonObject.get("reviewer_name");
   } catch (Exception exception) {
     Debug.displayStack(this, exception);
   }
   try {
     _description = (String) jsonObject.get("description");
   } catch (Exception exception) {
     Debug.displayStack(this, exception);
   }
   try {
     _reviewerIconURI = (String) jsonObject.get("reviewer_icon_uri");
   } catch (Exception exception) {
     Debug.displayStack(this, exception);
   }
   try {
     _sourceURI = (String) jsonObject.get("review_source_uri");
   } catch (Exception exception) {
     Debug.displayStack(this, exception);
   }
   try {
     _imageURI = (String) jsonObject.get("review_image_uri");
   } catch (Exception exception) {
     Debug.displayStack(this, exception);
   }
 }
 public String getDateAsString() {
   return DateUtils.getISO8601String(_date);
 }