예제 #1
0
 public WeatherCondition(JSONObject json) {
   this.code = ConditionCode.valueof(json.optInt(WeatherCondition.JSON_ID, Integer.MIN_VALUE));
   this.main = json.optString(WeatherCondition.JSON_MAIN);
   this.description = json.optString(WeatherCondition.JSON_DESCRIPTION);
   this.iconName = json.optString(WeatherCondition.JSON_ICON);
 }
예제 #2
0
 public static ConditionCode valueof(int id) {
   for (ConditionCode condition : ConditionCode.values()) {
     if (condition.id == id) return condition;
   }
   return ConditionCode.UNKNOWN;
 }