]> git.basschouten.com Git - openhab-addons.git/commitdiff
[openweathermap] Code cleanup (#12311)
authorChristoph Weitkamp <github@christophweitkamp.de>
Fri, 18 Feb 2022 07:47:35 +0000 (08:47 +0100)
committerGitHub <noreply@github.com>
Fri, 18 Feb 2022 07:47:35 +0000 (08:47 +0100)
Signed-off-by: Christoph Weitkamp <github@christophweitkamp.de>
30 files changed:
bundles/org.openhab.binding.openweathermap/src/main/java/org/openhab/binding/openweathermap/internal/connection/OpenWeatherMapConnection.java
bundles/org.openhab.binding.openweathermap/src/main/java/org/openhab/binding/openweathermap/internal/dto/OpenWeatherMapJsonAirPollutionData.java
bundles/org.openhab.binding.openweathermap/src/main/java/org/openhab/binding/openweathermap/internal/dto/OpenWeatherMapJsonWeatherData.java
bundles/org.openhab.binding.openweathermap/src/main/java/org/openhab/binding/openweathermap/internal/dto/OpenWeatherMapOneCallAPIData.java [new file with mode: 0644]
bundles/org.openhab.binding.openweathermap/src/main/java/org/openhab/binding/openweathermap/internal/dto/OpenWeatherMapOneCallHistAPIData.java [new file with mode: 0644]
bundles/org.openhab.binding.openweathermap/src/main/java/org/openhab/binding/openweathermap/internal/dto/base/Precipitation.java [new file with mode: 0644]
bundles/org.openhab.binding.openweathermap/src/main/java/org/openhab/binding/openweathermap/internal/dto/base/Rain.java [deleted file]
bundles/org.openhab.binding.openweathermap/src/main/java/org/openhab/binding/openweathermap/internal/dto/base/Snow.java [deleted file]
bundles/org.openhab.binding.openweathermap/src/main/java/org/openhab/binding/openweathermap/internal/dto/forecast/daily/List.java
bundles/org.openhab.binding.openweathermap/src/main/java/org/openhab/binding/openweathermap/internal/dto/forecast/hourly/List.java
bundles/org.openhab.binding.openweathermap/src/main/java/org/openhab/binding/openweathermap/internal/dto/onecall/Current.java
bundles/org.openhab.binding.openweathermap/src/main/java/org/openhab/binding/openweathermap/internal/dto/onecall/Daily.java
bundles/org.openhab.binding.openweathermap/src/main/java/org/openhab/binding/openweathermap/internal/dto/onecall/FeelsLike.java [deleted file]
bundles/org.openhab.binding.openweathermap/src/main/java/org/openhab/binding/openweathermap/internal/dto/onecall/Hourly.java
bundles/org.openhab.binding.openweathermap/src/main/java/org/openhab/binding/openweathermap/internal/dto/onecall/Minutely.java
bundles/org.openhab.binding.openweathermap/src/main/java/org/openhab/binding/openweathermap/internal/dto/onecall/OpenWeatherMapOneCallAPIData.java [deleted file]
bundles/org.openhab.binding.openweathermap/src/main/java/org/openhab/binding/openweathermap/internal/dto/onecall/Precipitation.java [new file with mode: 0644]
bundles/org.openhab.binding.openweathermap/src/main/java/org/openhab/binding/openweathermap/internal/dto/onecall/Rain.java [deleted file]
bundles/org.openhab.binding.openweathermap/src/main/java/org/openhab/binding/openweathermap/internal/dto/onecall/Snow.java [deleted file]
bundles/org.openhab.binding.openweathermap/src/main/java/org/openhab/binding/openweathermap/internal/dto/onecall/Temp.java [deleted file]
bundles/org.openhab.binding.openweathermap/src/main/java/org/openhab/binding/openweathermap/internal/dto/onecall/Weather.java
bundles/org.openhab.binding.openweathermap/src/main/java/org/openhab/binding/openweathermap/internal/dto/onecallhist/Current.java [deleted file]
bundles/org.openhab.binding.openweathermap/src/main/java/org/openhab/binding/openweathermap/internal/dto/onecallhist/Hourly.java
bundles/org.openhab.binding.openweathermap/src/main/java/org/openhab/binding/openweathermap/internal/dto/onecallhist/OpenWeatherMapOneCallHistAPIData.java [deleted file]
bundles/org.openhab.binding.openweathermap/src/main/java/org/openhab/binding/openweathermap/internal/dto/onecallhist/Rain.java [deleted file]
bundles/org.openhab.binding.openweathermap/src/main/java/org/openhab/binding/openweathermap/internal/dto/onecallhist/Snow.java [deleted file]
bundles/org.openhab.binding.openweathermap/src/main/java/org/openhab/binding/openweathermap/internal/dto/onecallhist/Weather.java [deleted file]
bundles/org.openhab.binding.openweathermap/src/main/java/org/openhab/binding/openweathermap/internal/handler/OpenWeatherMapOneCallHandler.java
bundles/org.openhab.binding.openweathermap/src/main/java/org/openhab/binding/openweathermap/internal/handler/OpenWeatherMapOneCallHistoryHandler.java
bundles/org.openhab.binding.openweathermap/src/main/java/org/openhab/binding/openweathermap/internal/handler/OpenWeatherMapWeatherAndForecastHandler.java

index 435ff6472e078d03581a8a24a7b7a02742167671..70e2967f2b2c7574679e6af89acc7e5210b664b2 100644 (file)
@@ -40,8 +40,8 @@ import org.openhab.binding.openweathermap.internal.dto.OpenWeatherMapJsonDailyFo
 import org.openhab.binding.openweathermap.internal.dto.OpenWeatherMapJsonHourlyForecastData;
 import org.openhab.binding.openweathermap.internal.dto.OpenWeatherMapJsonUVIndexData;
 import org.openhab.binding.openweathermap.internal.dto.OpenWeatherMapJsonWeatherData;
-import org.openhab.binding.openweathermap.internal.dto.onecall.OpenWeatherMapOneCallAPIData;
-import org.openhab.binding.openweathermap.internal.dto.onecallhist.OpenWeatherMapOneCallHistAPIData;
+import org.openhab.binding.openweathermap.internal.dto.OpenWeatherMapOneCallAPIData;
+import org.openhab.binding.openweathermap.internal.dto.OpenWeatherMapOneCallHistAPIData;
 import org.openhab.binding.openweathermap.internal.handler.OpenWeatherMapAPIHandler;
 import org.openhab.core.cache.ByteArrayFileCache;
 import org.openhab.core.cache.ExpiringCacheMap;
index 0042cb65437e521cef7de40bb4f872bc625e49a5..ec83bc95790af50c4b907439e9e363feac8ea314 100644 (file)
@@ -12,6 +12,7 @@
  */
 package org.openhab.binding.openweathermap.internal.dto;
 
+import org.openhab.binding.openweathermap.internal.dto.airpollution.List;
 import org.openhab.binding.openweathermap.internal.dto.base.Coord;
 
 /**
@@ -22,5 +23,5 @@ import org.openhab.binding.openweathermap.internal.dto.base.Coord;
  */
 public class OpenWeatherMapJsonAirPollutionData {
     public Coord coord;
-    public java.util.List<org.openhab.binding.openweathermap.internal.dto.airpollution.List> list;
+    public java.util.List<List> list;
 }
index b388162c2364583ac7fee6fd04f2956e52e46ede..43c555ae0ac4de353794027b800f0dce2d92f752 100644 (file)
@@ -17,8 +17,7 @@ import java.util.List;
 import org.eclipse.jdt.annotation.Nullable;
 import org.openhab.binding.openweathermap.internal.dto.base.Clouds;
 import org.openhab.binding.openweathermap.internal.dto.base.Coord;
-import org.openhab.binding.openweathermap.internal.dto.base.Rain;
-import org.openhab.binding.openweathermap.internal.dto.base.Snow;
+import org.openhab.binding.openweathermap.internal.dto.base.Precipitation;
 import org.openhab.binding.openweathermap.internal.dto.base.Weather;
 import org.openhab.binding.openweathermap.internal.dto.base.Wind;
 import org.openhab.binding.openweathermap.internal.dto.weather.Main;
@@ -38,8 +37,8 @@ public class OpenWeatherMapJsonWeatherData {
     private @Nullable Integer visibility;
     private Wind wind;
     private Clouds clouds;
-    private @Nullable Rain rain;
-    private @Nullable Snow snow;
+    private @Nullable Precipitation rain;
+    private @Nullable Precipitation snow;
     private Integer dt;
     private Sys sys;
     private Integer id;
@@ -102,19 +101,19 @@ public class OpenWeatherMapJsonWeatherData {
         this.clouds = clouds;
     }
 
-    public @Nullable Rain getRain() {
+    public @Nullable Precipitation getRain() {
         return rain;
     }
 
-    public void setRain(Rain rain) {
+    public void setRain(Precipitation rain) {
         this.rain = rain;
     }
 
-    public @Nullable Snow getSnow() {
+    public @Nullable Precipitation getSnow() {
         return snow;
     }
 
-    public void setSnow(Snow snow) {
+    public void setSnow(Precipitation snow) {
         this.snow = snow;
     }
 
diff --git a/bundles/org.openhab.binding.openweathermap/src/main/java/org/openhab/binding/openweathermap/internal/dto/OpenWeatherMapOneCallAPIData.java b/bundles/org.openhab.binding.openweathermap/src/main/java/org/openhab/binding/openweathermap/internal/dto/OpenWeatherMapOneCallAPIData.java
new file mode 100644 (file)
index 0000000..2ae2c0a
--- /dev/null
@@ -0,0 +1,113 @@
+/**
+ * Copyright (c) 2010-2022 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+package org.openhab.binding.openweathermap.internal.dto;
+
+import java.util.List;
+
+import org.eclipse.jdt.annotation.Nullable;
+import org.openhab.binding.openweathermap.internal.dto.onecall.Alert;
+import org.openhab.binding.openweathermap.internal.dto.onecall.Current;
+import org.openhab.binding.openweathermap.internal.dto.onecall.Daily;
+import org.openhab.binding.openweathermap.internal.dto.onecall.Hourly;
+import org.openhab.binding.openweathermap.internal.dto.onecall.Minutely;
+
+import com.google.gson.annotations.SerializedName;
+
+/**
+ * Holds the data from the deserialised JSON response. Created using http://www.jsonschema2pojo.org/.
+ * Settings:
+ * Annotation Style: GSON
+ * Use primitive types
+ * Use double numbers
+ * allow additional properties
+ *
+ * @author Wolfgang Klimt - Initial contribution
+ * @author Christoph Weitkamp - Added weather alerts
+ */
+public class OpenWeatherMapOneCallAPIData {
+    private double lat;
+    private double lon;
+    private String timezone;
+    @SerializedName("timezone_offset")
+    private int timezoneOffset;
+    private Current current;
+    private List<Minutely> minutely;
+    private List<Hourly> hourly;
+    private List<Daily> daily;
+
+    public @Nullable List<Alert> alerts;
+
+    public double getLat() {
+        return lat;
+    }
+
+    public void setLat(double lat) {
+        this.lat = lat;
+    }
+
+    public double getLon() {
+        return lon;
+    }
+
+    public void setLon(double lon) {
+        this.lon = lon;
+    }
+
+    public String getTimezone() {
+        return timezone;
+    }
+
+    public void setTimezone(String timezone) {
+        this.timezone = timezone;
+    }
+
+    public int getTimezoneOffset() {
+        return timezoneOffset;
+    }
+
+    public void setTimezoneOffset(int timezoneOffset) {
+        this.timezoneOffset = timezoneOffset;
+    }
+
+    public Current getCurrent() {
+        return current;
+    }
+
+    public void setCurrent(Current current) {
+        this.current = current;
+    }
+
+    public List<Minutely> getMinutely() {
+        return minutely;
+    }
+
+    public void setMinutely(List<Minutely> minutely) {
+        this.minutely = minutely;
+    }
+
+    public List<Hourly> getHourly() {
+        return hourly;
+    }
+
+    public void setHourly(List<Hourly> hourly) {
+        this.hourly = hourly;
+    }
+
+    public List<Daily> getDaily() {
+        return daily;
+    }
+
+    public void setDaily(List<Daily> daily) {
+        this.daily = daily;
+    }
+}
diff --git a/bundles/org.openhab.binding.openweathermap/src/main/java/org/openhab/binding/openweathermap/internal/dto/OpenWeatherMapOneCallHistAPIData.java b/bundles/org.openhab.binding.openweathermap/src/main/java/org/openhab/binding/openweathermap/internal/dto/OpenWeatherMapOneCallHistAPIData.java
new file mode 100644 (file)
index 0000000..d4676dc
--- /dev/null
@@ -0,0 +1,88 @@
+/**
+ * Copyright (c) 2010-2022 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+package org.openhab.binding.openweathermap.internal.dto;
+
+import java.util.List;
+
+import org.openhab.binding.openweathermap.internal.dto.onecall.Current;
+import org.openhab.binding.openweathermap.internal.dto.onecallhist.Hourly;
+
+import com.google.gson.annotations.SerializedName;
+
+/**
+ * Holds the data from the deserialised JSON response. Created using http://www.jsonschema2pojo.org/.
+ * Settings:
+ * Annotation Style: GSON
+ * Use primitive types
+ * Use double numbers
+ * allow additional properties
+ *
+ * @author Wolfgang Klimt - Initial contribution
+ */
+public class OpenWeatherMapOneCallHistAPIData {
+    private double lat;
+    private double lon;
+    private String timezone;
+    @SerializedName("timezone_offset")
+    private int timezoneOffset;
+    private Current current;
+    private List<Hourly> hourly = null;
+
+    public double getLat() {
+        return lat;
+    }
+
+    public void setLat(double lat) {
+        this.lat = lat;
+    }
+
+    public double getLon() {
+        return lon;
+    }
+
+    public void setLon(double lon) {
+        this.lon = lon;
+    }
+
+    public String getTimezone() {
+        return timezone;
+    }
+
+    public void setTimezone(String timezone) {
+        this.timezone = timezone;
+    }
+
+    public int getTimezoneOffset() {
+        return timezoneOffset;
+    }
+
+    public void setTimezoneOffset(int timezoneOffset) {
+        this.timezoneOffset = timezoneOffset;
+    }
+
+    public Current getCurrent() {
+        return current;
+    }
+
+    public void setCurrent(Current current) {
+        this.current = current;
+    }
+
+    public List<Hourly> getHourly() {
+        return hourly;
+    }
+
+    public void setHourly(List<Hourly> hourly) {
+        this.hourly = hourly;
+    }
+}
diff --git a/bundles/org.openhab.binding.openweathermap/src/main/java/org/openhab/binding/openweathermap/internal/dto/base/Precipitation.java b/bundles/org.openhab.binding.openweathermap/src/main/java/org/openhab/binding/openweathermap/internal/dto/base/Precipitation.java
new file mode 100644 (file)
index 0000000..f73c3a6
--- /dev/null
@@ -0,0 +1,49 @@
+/**
+ * Copyright (c) 2010-2022 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+package org.openhab.binding.openweathermap.internal.dto.base;
+
+import org.eclipse.jdt.annotation.Nullable;
+
+import com.google.gson.annotations.SerializedName;
+
+/**
+ * Generated Plain Old Java Objects class for {@link Precipitation} from JSON.
+ *
+ * @author Christoph Weitkamp - Initial contribution
+ */
+public class Precipitation {
+    @SerializedName("1h")
+    private @Nullable Double oneHour;
+    @SerializedName("3h")
+    private @Nullable Double threeHours;
+
+    public @Nullable Double get1h() {
+        return oneHour;
+    }
+
+    public void set1h(Double oneHour) {
+        this.oneHour = oneHour;
+    }
+
+    public @Nullable Double get3h() {
+        return threeHours;
+    }
+
+    public void set3h(Double threeHours) {
+        this.threeHours = threeHours;
+    }
+
+    public Double getVolume() {
+        return oneHour != null ? oneHour : threeHours != null ? threeHours / 3 : 0;
+    }
+}
diff --git a/bundles/org.openhab.binding.openweathermap/src/main/java/org/openhab/binding/openweathermap/internal/dto/base/Rain.java b/bundles/org.openhab.binding.openweathermap/src/main/java/org/openhab/binding/openweathermap/internal/dto/base/Rain.java
deleted file mode 100644 (file)
index da93b32..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-/**
- * Copyright (c) 2010-2022 Contributors to the openHAB project
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0
- *
- * SPDX-License-Identifier: EPL-2.0
- */
-package org.openhab.binding.openweathermap.internal.dto.base;
-
-import org.eclipse.jdt.annotation.Nullable;
-
-import com.google.gson.annotations.SerializedName;
-
-/**
- * Generated Plain Old Java Objects class for {@link Rain} from JSON.
- *
- * @author Christoph Weitkamp - Initial contribution
- */
-public class Rain {
-    @SerializedName("1h")
-    private @Nullable Double oneHour;
-    @SerializedName("3h")
-    private @Nullable Double threeHours;
-
-    public @Nullable Double get1h() {
-        return oneHour;
-    }
-
-    public void set1h(Double oneHour) {
-        this.oneHour = oneHour;
-    }
-
-    public @Nullable Double get3h() {
-        return threeHours;
-    }
-
-    public void set3h(Double threeHours) {
-        this.threeHours = threeHours;
-    }
-
-    public Double getVolume() {
-        return oneHour != null ? oneHour : threeHours != null ? threeHours / 3 : 0;
-    }
-}
diff --git a/bundles/org.openhab.binding.openweathermap/src/main/java/org/openhab/binding/openweathermap/internal/dto/base/Snow.java b/bundles/org.openhab.binding.openweathermap/src/main/java/org/openhab/binding/openweathermap/internal/dto/base/Snow.java
deleted file mode 100644 (file)
index ea83ec0..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-/**
- * Copyright (c) 2010-2022 Contributors to the openHAB project
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0
- *
- * SPDX-License-Identifier: EPL-2.0
- */
-package org.openhab.binding.openweathermap.internal.dto.base;
-
-import org.eclipse.jdt.annotation.Nullable;
-
-import com.google.gson.annotations.SerializedName;
-
-/**
- * Generated Plain Old Java Objects class for {@link Snow} from JSON.
- *
- * @author Christoph Weitkamp - Initial contribution
- */
-public class Snow {
-    @SerializedName("1h")
-    private @Nullable Double oneHour;
-    @SerializedName("3h")
-    private @Nullable Double threeHours;
-
-    public @Nullable Double get1h() {
-        return oneHour;
-    }
-
-    public void set1h(Double oneHour) {
-        this.oneHour = oneHour;
-    }
-
-    public @Nullable Double get3h() {
-        return threeHours;
-    }
-
-    public void set3h(Double threeHours) {
-        this.threeHours = threeHours;
-    }
-
-    public Double getVolume() {
-        return oneHour != null ? oneHour : threeHours != null ? threeHours / 3 : 0;
-    }
-}
index a68af62f315dcd0e6e2980c6d6ba34b8ce9713b2..94883fce4ea66fe781b15dc22cf3162865edb11a 100644 (file)
@@ -72,11 +72,11 @@ public class List {
         this.temp = temp;
     }
 
-    public @Nullable FeelsLikeTemp getFeelsLikeTemp() {
+    public @Nullable FeelsLikeTemp getFeelsLike() {
         return feelsLikeTemp;
     }
 
-    public void setFeelsLikeTemp(FeelsLikeTemp feelsLikeTemp) {
+    public void setFeelsLike(FeelsLikeTemp feelsLikeTemp) {
         this.feelsLikeTemp = feelsLikeTemp;
     }
 
index 2e477de40edcdce343f42f417d90b68e66363172..cc6702a586be03663c77967b511495d50a71db0a 100644 (file)
@@ -14,8 +14,7 @@ package org.openhab.binding.openweathermap.internal.dto.forecast.hourly;
 
 import org.eclipse.jdt.annotation.Nullable;
 import org.openhab.binding.openweathermap.internal.dto.base.Clouds;
-import org.openhab.binding.openweathermap.internal.dto.base.Rain;
-import org.openhab.binding.openweathermap.internal.dto.base.Snow;
+import org.openhab.binding.openweathermap.internal.dto.base.Precipitation;
 import org.openhab.binding.openweathermap.internal.dto.base.Weather;
 import org.openhab.binding.openweathermap.internal.dto.base.Wind;
 import org.openhab.binding.openweathermap.internal.dto.weather.Main;
@@ -33,8 +32,8 @@ public class List {
     private java.util.List<Weather> weather;
     private Clouds clouds;
     private Wind wind;
-    private @Nullable Rain rain;
-    private @Nullable Snow snow;
+    private @Nullable Precipitation rain;
+    private @Nullable Precipitation snow;
     private Sys sys;
     @SerializedName("dt_txt")
     private String dtTxt;
@@ -79,19 +78,19 @@ public class List {
         this.wind = wind;
     }
 
-    public @Nullable Rain getRain() {
+    public @Nullable Precipitation getRain() {
         return rain;
     }
 
-    public void setRain(Rain rain) {
+    public void setRain(Precipitation rain) {
         this.rain = rain;
     }
 
-    public @Nullable Snow getSnow() {
+    public @Nullable Precipitation getSnow() {
         return snow;
     }
 
-    public void setSnow(Snow snow) {
+    public void setSnow(Precipitation snow) {
         this.snow = snow;
     }
 
index 421d8054f728cc7f2910896db7893bb84e59d88a..13c9f9a1ac1a518943695e4deafaea62532d2f1d 100644 (file)
@@ -14,7 +14,6 @@ package org.openhab.binding.openweathermap.internal.dto.onecall;
 
 import java.util.List;
 
-import com.google.gson.annotations.Expose;
 import com.google.gson.annotations.SerializedName;
 
 /**
@@ -28,58 +27,28 @@ import com.google.gson.annotations.SerializedName;
  * @author Wolfgang Klimt - Initial contribution
  */
 public class Current {
-
-    @SerializedName("dt")
-    @Expose
     private int dt;
-    @SerializedName("sunrise")
-    @Expose
     private int sunrise;
-    @SerializedName("sunset")
-    @Expose
     private int sunset;
-    @SerializedName("temp")
-    @Expose
     private double temp;
     @SerializedName("feels_like")
-    @Expose
     private double feelsLike;
-    @SerializedName("pressure")
-    @Expose
     private int pressure;
-    @SerializedName("humidity")
-    @Expose
     private int humidity;
     @SerializedName("dew_point")
-    @Expose
     private double dewPoint;
-    @SerializedName("uvi")
-    @Expose
     private double uvi;
-    @SerializedName("clouds")
-    @Expose
     private int clouds;
-    @SerializedName("visibility")
-    @Expose
     private int visibility;
     @SerializedName("wind_speed")
-    @Expose
     private double windSpeed;
     @SerializedName("wind_deg")
-    @Expose
     private int windDeg;
     @SerializedName("wind_gust")
-    @Expose
     private double windGust;
-    @SerializedName("weather")
-    @Expose
     private List<Weather> weather = null;
-    @SerializedName("rain")
-    @Expose
-    private Rain rain;
-    @SerializedName("snow")
-    @Expose
-    private Snow snow;
+    private Precipitation rain;
+    private Precipitation snow;
 
     public int getDt() {
         return dt;
@@ -201,19 +170,19 @@ public class Current {
         this.weather = weather;
     }
 
-    public Rain getRain() {
+    public Precipitation getRain() {
         return rain;
     }
 
-    public void setRain(Rain rain) {
+    public void setRain(Precipitation rain) {
         this.rain = rain;
     }
 
-    public Snow getSnow() {
+    public Precipitation getSnow() {
         return snow;
     }
 
-    public void setSnow(Snow snow) {
+    public void setSnow(Precipitation snow) {
         this.snow = snow;
     }
 }
index c484c4210167e431103bc9ff20f59a881c1913f4..64497ddef08b6719a3d9a3f19cac4b9802009efc 100644 (file)
@@ -14,7 +14,9 @@ package org.openhab.binding.openweathermap.internal.dto.onecall;
 
 import java.util.List;
 
-import com.google.gson.annotations.Expose;
+import org.openhab.binding.openweathermap.internal.dto.forecast.daily.FeelsLikeTemp;
+import org.openhab.binding.openweathermap.internal.dto.forecast.daily.Temp;
+
 import com.google.gson.annotations.SerializedName;
 
 /**
@@ -28,60 +30,28 @@ import com.google.gson.annotations.SerializedName;
  * @author Wolfgang Klimt - Initial contribution
  */
 public class Daily {
-
-    @SerializedName("dt")
-    @Expose
     private int dt;
-    @SerializedName("sunrise")
-    @Expose
     private int sunrise;
-    @SerializedName("sunset")
-    @Expose
     private int sunset;
-    @SerializedName("temp")
-    @Expose
     private Temp temp;
     @SerializedName("feels_like")
-    @Expose
-    private FeelsLike feelsLike;
-    @SerializedName("pressure")
-    @Expose
+    private FeelsLikeTemp feelsLikeTemp;
     private int pressure;
-    @SerializedName("humidity")
-    @Expose
     private int humidity;
     @SerializedName("dew_point")
-    @Expose
     private double dewPoint;
     @SerializedName("wind_speed")
-    @Expose
     private double windSpeed;
     @SerializedName("wind_deg")
-    @Expose
     private int windDeg;
     @SerializedName("wind_gust")
-    @Expose
     private double windGust;
-    @SerializedName("weather")
-    @Expose
     private List<Weather> weather = null;
-    @SerializedName("clouds")
-    @Expose
     private int clouds;
-    @SerializedName("pop")
-    @Expose
     private double pop;
-    @SerializedName("visibility")
-    @Expose
     private int visibility;
-    @SerializedName("rain")
-    @Expose
     private double rain;
-    @SerializedName("snow")
-    @Expose
     private double snow;
-    @SerializedName("uvi")
-    @Expose
     private double uvi;
 
     public int getDt() {
@@ -116,12 +86,12 @@ public class Daily {
         this.temp = temp;
     }
 
-    public FeelsLike getFeelsLike() {
-        return feelsLike;
+    public FeelsLikeTemp getFeelsLike() {
+        return feelsLikeTemp;
     }
 
-    public void setFeelsLike(FeelsLike feelsLike) {
-        this.feelsLike = feelsLike;
+    public void setFeelsLike(FeelsLikeTemp feelsLikeTemp) {
+        this.feelsLikeTemp = feelsLikeTemp;
     }
 
     public int getPressure() {
diff --git a/bundles/org.openhab.binding.openweathermap/src/main/java/org/openhab/binding/openweathermap/internal/dto/onecall/FeelsLike.java b/bundles/org.openhab.binding.openweathermap/src/main/java/org/openhab/binding/openweathermap/internal/dto/onecall/FeelsLike.java
deleted file mode 100644 (file)
index 25964f5..0000000
+++ /dev/null
@@ -1,74 +0,0 @@
-/**
- * Copyright (c) 2010-2022 Contributors to the openHAB project
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0
- *
- * SPDX-License-Identifier: EPL-2.0
- */
-package org.openhab.binding.openweathermap.internal.dto.onecall;
-
-import com.google.gson.annotations.Expose;
-import com.google.gson.annotations.SerializedName;
-
-/**
- * Holds the data from the deserialised JSON response. Created using http://www.jsonschema2pojo.org/.
- * Settings:
- * Annotation Style: GSON
- * Use primitive types
- * Use double numbers
- * allow additional properties
- *
- * @author Wolfgang Klimt - Initial contribution
- */
-public class FeelsLike {
-
-    @SerializedName("day")
-    @Expose
-    private double day;
-    @SerializedName("night")
-    @Expose
-    private double night;
-    @SerializedName("eve")
-    @Expose
-    private double eve;
-    @SerializedName("morn")
-    @Expose
-    private double morn;
-
-    public double getDay() {
-        return day;
-    }
-
-    public void setDay(double day) {
-        this.day = day;
-    }
-
-    public double getNight() {
-        return night;
-    }
-
-    public void setNight(double night) {
-        this.night = night;
-    }
-
-    public double getEve() {
-        return eve;
-    }
-
-    public void setEve(double eve) {
-        this.eve = eve;
-    }
-
-    public double getMorn() {
-        return morn;
-    }
-
-    public void setMorn(double morn) {
-        this.morn = morn;
-    }
-}
index 384dd25584476d7c31c7c8fb30510aca3e20d3c9..4ae26900fbaa78bc7d371c767e17b3016504ac58 100644 (file)
@@ -14,7 +14,6 @@ package org.openhab.binding.openweathermap.internal.dto.onecall;
 
 import java.util.List;
 
-import com.google.gson.annotations.Expose;
 import com.google.gson.annotations.SerializedName;
 
 /**
@@ -28,52 +27,26 @@ import com.google.gson.annotations.SerializedName;
  * @author Wolfgang Klimt - Initial contribution
  */
 public class Hourly {
-
-    @SerializedName("dt")
-    @Expose
     private int dt;
-    @SerializedName("temp")
-    @Expose
     private double temp;
     @SerializedName("feels_like")
-    @Expose
     private double feelsLike;
-    @SerializedName("pressure")
-    @Expose
     private int pressure;
-    @SerializedName("humidity")
-    @Expose
     private int humidity;
     @SerializedName("dew_point")
-    @Expose
     private double dewPoint;
-    @SerializedName("clouds")
-    @Expose
     private int clouds;
-    @SerializedName("visibility")
-    @Expose
     private int visibility;
     @SerializedName("wind_speed")
-    @Expose
     private double windSpeed;
     @SerializedName("wind_deg")
-    @Expose
     private int windDeg;
     @SerializedName("wind_gust")
-    @Expose
     private double windGust;
-    @SerializedName("weather")
-    @Expose
     private List<Weather> weather = null;
-    @SerializedName("pop")
-    @Expose
     private double pop;
-    @SerializedName("rain")
-    @Expose
-    private Rain rain;
-    @SerializedName("snow")
-    @Expose
-    private Snow snow;
+    private Precipitation rain;
+    private Precipitation snow;
 
     public int getDt() {
         return dt;
@@ -179,19 +152,19 @@ public class Hourly {
         this.pop = pop;
     }
 
-    public Rain getRain() {
+    public Precipitation getRain() {
         return rain;
     }
 
-    public void setRain(Rain rain) {
+    public void setRain(Precipitation rain) {
         this.rain = rain;
     }
 
-    public Snow getSnow() {
+    public Precipitation getSnow() {
         return snow;
     }
 
-    public void setSnow(Snow snow) {
+    public void setSnow(Precipitation snow) {
         this.snow = snow;
     }
 }
index bce4596831600e3bf85c0a126604bb7263b15c08..4be271964944affe371e4ccf82607308dcf6b9bb 100644 (file)
@@ -12,9 +12,6 @@
  */
 package org.openhab.binding.openweathermap.internal.dto.onecall;
 
-import com.google.gson.annotations.Expose;
-import com.google.gson.annotations.SerializedName;
-
 /**
  * Holds the data from the deserialised JSON response. Created using http://www.jsonschema2pojo.org/.
  * Settings:
@@ -26,12 +23,7 @@ import com.google.gson.annotations.SerializedName;
  * @author Wolfgang Klimt - Initial contribution
  */
 public class Minutely {
-
-    @SerializedName("dt")
-    @Expose
     private int dt;
-    @SerializedName("precipitation")
-    @Expose
     private double precipitation;
 
     public int getDt() {
diff --git a/bundles/org.openhab.binding.openweathermap/src/main/java/org/openhab/binding/openweathermap/internal/dto/onecall/OpenWeatherMapOneCallAPIData.java b/bundles/org.openhab.binding.openweathermap/src/main/java/org/openhab/binding/openweathermap/internal/dto/onecall/OpenWeatherMapOneCallAPIData.java
deleted file mode 100644 (file)
index cafa413..0000000
+++ /dev/null
@@ -1,109 +0,0 @@
-/**
- * Copyright (c) 2010-2022 Contributors to the openHAB project
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0
- *
- * SPDX-License-Identifier: EPL-2.0
- */
-package org.openhab.binding.openweathermap.internal.dto.onecall;
-
-import java.util.List;
-
-import org.eclipse.jdt.annotation.Nullable;
-
-import com.google.gson.annotations.SerializedName;
-
-/**
- * Holds the data from the deserialised JSON response. Created using http://www.jsonschema2pojo.org/.
- * Settings:
- * Annotation Style: GSON
- * Use primitive types
- * Use double numbers
- * allow additional properties
- *
- * @author Wolfgang Klimt - Initial contribution
- * @author Christoph Weitkamp - Added weather alerts
- */
-public class OpenWeatherMapOneCallAPIData {
-
-    private double lat;
-    private double lon;
-    private String timezone;
-    @SerializedName("timezone_offset")
-    private int timezoneOffset;
-    private Current current;
-    private List<Minutely> minutely;
-    private List<Hourly> hourly;
-    private List<Daily> daily;
-
-    public @Nullable List<Alert> alerts;
-
-    public double getLat() {
-        return lat;
-    }
-
-    public void setLat(double lat) {
-        this.lat = lat;
-    }
-
-    public double getLon() {
-        return lon;
-    }
-
-    public void setLon(double lon) {
-        this.lon = lon;
-    }
-
-    public String getTimezone() {
-        return timezone;
-    }
-
-    public void setTimezone(String timezone) {
-        this.timezone = timezone;
-    }
-
-    public int getTimezoneOffset() {
-        return timezoneOffset;
-    }
-
-    public void setTimezoneOffset(int timezoneOffset) {
-        this.timezoneOffset = timezoneOffset;
-    }
-
-    public Current getCurrent() {
-        return current;
-    }
-
-    public void setCurrent(Current current) {
-        this.current = current;
-    }
-
-    public List<Minutely> getMinutely() {
-        return minutely;
-    }
-
-    public void setMinutely(List<Minutely> minutely) {
-        this.minutely = minutely;
-    }
-
-    public List<Hourly> getHourly() {
-        return hourly;
-    }
-
-    public void setHourly(List<Hourly> hourly) {
-        this.hourly = hourly;
-    }
-
-    public List<Daily> getDaily() {
-        return daily;
-    }
-
-    public void setDaily(List<Daily> daily) {
-        this.daily = daily;
-    }
-}
diff --git a/bundles/org.openhab.binding.openweathermap/src/main/java/org/openhab/binding/openweathermap/internal/dto/onecall/Precipitation.java b/bundles/org.openhab.binding.openweathermap/src/main/java/org/openhab/binding/openweathermap/internal/dto/onecall/Precipitation.java
new file mode 100644 (file)
index 0000000..52302fd
--- /dev/null
@@ -0,0 +1,38 @@
+/**
+ * Copyright (c) 2010-2022 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+package org.openhab.binding.openweathermap.internal.dto.onecall;
+
+import com.google.gson.annotations.SerializedName;
+
+/**
+ * Holds the data from the deserialised JSON response. Created using http://www.jsonschema2pojo.org/.
+ * Settings:
+ * Annotation Style: GSON
+ * Use primitive types
+ * Use double numbers
+ * allow additional properties
+ *
+ * @author Wolfgang Klimt - Initial contribution
+ */
+public class Precipitation {
+    @SerializedName("1h")
+    private double oneHour;
+
+    public double get1h() {
+        return oneHour;
+    }
+
+    public void set1h(double oneHour) {
+        this.oneHour = oneHour;
+    }
+}
diff --git a/bundles/org.openhab.binding.openweathermap/src/main/java/org/openhab/binding/openweathermap/internal/dto/onecall/Rain.java b/bundles/org.openhab.binding.openweathermap/src/main/java/org/openhab/binding/openweathermap/internal/dto/onecall/Rain.java
deleted file mode 100644 (file)
index 5cb5637..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-/**
- * Copyright (c) 2010-2022 Contributors to the openHAB project
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0
- *
- * SPDX-License-Identifier: EPL-2.0
- */
-package org.openhab.binding.openweathermap.internal.dto.onecall;
-
-import com.google.gson.annotations.Expose;
-import com.google.gson.annotations.SerializedName;
-
-/**
- * Holds the data from the deserialised JSON response. Created using http://www.jsonschema2pojo.org/.
- * Settings:
- * Annotation Style: GSON
- * Use primitive types
- * Use double numbers
- * allow additional properties
- *
- * @author Wolfgang Klimt - Initial contribution
- */
-public class Rain {
-
-    @SerializedName("1h")
-    @Expose
-    private double _1h;
-
-    public double get1h() {
-        return _1h;
-    }
-
-    public void set1h(double _1h) {
-        this._1h = _1h;
-    }
-}
diff --git a/bundles/org.openhab.binding.openweathermap/src/main/java/org/openhab/binding/openweathermap/internal/dto/onecall/Snow.java b/bundles/org.openhab.binding.openweathermap/src/main/java/org/openhab/binding/openweathermap/internal/dto/onecall/Snow.java
deleted file mode 100644 (file)
index c27ad99..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-/**
- * Copyright (c) 2010-2022 Contributors to the openHAB project
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0
- *
- * SPDX-License-Identifier: EPL-2.0
- */
-package org.openhab.binding.openweathermap.internal.dto.onecall;
-
-import com.google.gson.annotations.Expose;
-import com.google.gson.annotations.SerializedName;
-
-/**
- * Holds the data from the deserialised JSON response. Created using http://www.jsonschema2pojo.org/.
- * Settings:
- * Annotation Style: GSON
- * Use primitive types
- * Use double numbers
- * allow additional properties
- *
- * @author Wolfgang Klimt - Initial contribution
- */
-public class Snow {
-
-    @SerializedName("1h")
-    @Expose
-    private double _1h;
-
-    public double get1h() {
-        return _1h;
-    }
-
-    public void set1h(double _1h) {
-        this._1h = _1h;
-    }
-}
diff --git a/bundles/org.openhab.binding.openweathermap/src/main/java/org/openhab/binding/openweathermap/internal/dto/onecall/Temp.java b/bundles/org.openhab.binding.openweathermap/src/main/java/org/openhab/binding/openweathermap/internal/dto/onecall/Temp.java
deleted file mode 100644 (file)
index f365f0d..0000000
+++ /dev/null
@@ -1,96 +0,0 @@
-/**
- * Copyright (c) 2010-2022 Contributors to the openHAB project
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0
- *
- * SPDX-License-Identifier: EPL-2.0
- */
-package org.openhab.binding.openweathermap.internal.dto.onecall;
-
-import com.google.gson.annotations.Expose;
-import com.google.gson.annotations.SerializedName;
-
-/**
- * Holds the data from the deserialised JSON response. Created using http://www.jsonschema2pojo.org/.
- * Settings:
- * Annotation Style: GSON
- * Use primitive types
- * Use double numbers
- * allow additional properties
- *
- * @author Wolfgang Klimt - Initial contribution
- */
-public class Temp {
-
-    @SerializedName("day")
-    @Expose
-    private double day;
-    @SerializedName("min")
-    @Expose
-    private double min;
-    @SerializedName("max")
-    @Expose
-    private double max;
-    @SerializedName("night")
-    @Expose
-    private double night;
-    @SerializedName("eve")
-    @Expose
-    private double eve;
-    @SerializedName("morn")
-    @Expose
-    private double morn;
-
-    public double getDay() {
-        return day;
-    }
-
-    public void setDay(double day) {
-        this.day = day;
-    }
-
-    public double getMin() {
-        return min;
-    }
-
-    public void setMin(double min) {
-        this.min = min;
-    }
-
-    public double getMax() {
-        return max;
-    }
-
-    public void setMax(double max) {
-        this.max = max;
-    }
-
-    public double getNight() {
-        return night;
-    }
-
-    public void setNight(double night) {
-        this.night = night;
-    }
-
-    public double getEve() {
-        return eve;
-    }
-
-    public void setEve(double eve) {
-        this.eve = eve;
-    }
-
-    public double getMorn() {
-        return morn;
-    }
-
-    public void setMorn(double morn) {
-        this.morn = morn;
-    }
-}
index 68c1cfa09be238a128d92647d4a9a89c7c1c403d..d7b720f3a92573379f30ca742ec9f3dc77496832 100644 (file)
@@ -12,9 +12,6 @@
  */
 package org.openhab.binding.openweathermap.internal.dto.onecall;
 
-import com.google.gson.annotations.Expose;
-import com.google.gson.annotations.SerializedName;
-
 /**
  * Holds the data from the deserialised JSON response. Created using http://www.jsonschema2pojo.org/.
  * Settings:
@@ -26,18 +23,9 @@ import com.google.gson.annotations.SerializedName;
  * @author Wolfgang Klimt - Initial contribution
  */
 public class Weather {
-
-    @SerializedName("id")
-    @Expose
     private int id;
-    @SerializedName("main")
-    @Expose
     private String main;
-    @SerializedName("description")
-    @Expose
     private String description;
-    @SerializedName("icon")
-    @Expose
     private String icon;
 
     public int getId() {
diff --git a/bundles/org.openhab.binding.openweathermap/src/main/java/org/openhab/binding/openweathermap/internal/dto/onecallhist/Current.java b/bundles/org.openhab.binding.openweathermap/src/main/java/org/openhab/binding/openweathermap/internal/dto/onecallhist/Current.java
deleted file mode 100644 (file)
index d7e505e..0000000
+++ /dev/null
@@ -1,219 +0,0 @@
-/**
- * Copyright (c) 2010-2022 Contributors to the openHAB project
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0
- *
- * SPDX-License-Identifier: EPL-2.0
- */
-package org.openhab.binding.openweathermap.internal.dto.onecallhist;
-
-import java.util.List;
-
-import com.google.gson.annotations.Expose;
-import com.google.gson.annotations.SerializedName;
-
-/**
- * Holds the data from the deserialised JSON response. Created using http://www.jsonschema2pojo.org/.
- * Settings:
- * Annotation Style: GSON
- * Use primitive types
- * Use double numbers
- * allow additional properties
- *
- * @author Wolfgang Klimt - Initial contribution
- */
-public class Current {
-
-    @SerializedName("dt")
-    @Expose
-    private int dt;
-    @SerializedName("sunrise")
-    @Expose
-    private int sunrise;
-    @SerializedName("sunset")
-    @Expose
-    private int sunset;
-    @SerializedName("temp")
-    @Expose
-    private double temp;
-    @SerializedName("feels_like")
-    @Expose
-    private double feelsLike;
-    @SerializedName("pressure")
-    @Expose
-    private int pressure;
-    @SerializedName("humidity")
-    @Expose
-    private int humidity;
-    @SerializedName("dew_point")
-    @Expose
-    private double dewPoint;
-    @SerializedName("uvi")
-    @Expose
-    private double uvi;
-    @SerializedName("clouds")
-    @Expose
-    private int clouds;
-    @SerializedName("visibility")
-    @Expose
-    private int visibility;
-    @SerializedName("wind_speed")
-    @Expose
-    private double windSpeed;
-    @SerializedName("wind_deg")
-    @Expose
-    private int windDeg;
-    @SerializedName("wind_gust")
-    @Expose
-    private double windGust;
-    @SerializedName("weather")
-    @Expose
-    private List<Weather> weather = null;
-    @SerializedName("rain")
-    @Expose
-    private Rain rain;
-    @SerializedName("snow")
-    @Expose
-    private Snow snow;
-
-    public int getDt() {
-        return dt;
-    }
-
-    public void setDt(int dt) {
-        this.dt = dt;
-    }
-
-    public int getSunrise() {
-        return sunrise;
-    }
-
-    public void setSunrise(int sunrise) {
-        this.sunrise = sunrise;
-    }
-
-    public int getSunset() {
-        return sunset;
-    }
-
-    public void setSunset(int sunset) {
-        this.sunset = sunset;
-    }
-
-    public double getTemp() {
-        return temp;
-    }
-
-    public void setTemp(double temp) {
-        this.temp = temp;
-    }
-
-    public double getFeelsLike() {
-        return feelsLike;
-    }
-
-    public void setFeelsLike(double feelsLike) {
-        this.feelsLike = feelsLike;
-    }
-
-    public int getPressure() {
-        return pressure;
-    }
-
-    public void setPressure(int pressure) {
-        this.pressure = pressure;
-    }
-
-    public int getHumidity() {
-        return humidity;
-    }
-
-    public void setHumidity(int humidity) {
-        this.humidity = humidity;
-    }
-
-    public double getDewPoint() {
-        return dewPoint;
-    }
-
-    public void setDewPoint(double dewPoint) {
-        this.dewPoint = dewPoint;
-    }
-
-    public double getUvi() {
-        return uvi;
-    }
-
-    public void setUvi(double uvi) {
-        this.uvi = uvi;
-    }
-
-    public int getClouds() {
-        return clouds;
-    }
-
-    public void setClouds(int clouds) {
-        this.clouds = clouds;
-    }
-
-    public int getVisibility() {
-        return visibility;
-    }
-
-    public void setVisibility(int visibility) {
-        this.visibility = visibility;
-    }
-
-    public double getWindSpeed() {
-        return windSpeed;
-    }
-
-    public void setWindSpeed(double windSpeed) {
-        this.windSpeed = windSpeed;
-    }
-
-    public int getWindDeg() {
-        return windDeg;
-    }
-
-    public void setWindDeg(int windDeg) {
-        this.windDeg = windDeg;
-    }
-
-    public double getWindGust() {
-        return windGust;
-    }
-
-    public void setWindGust(double windGust) {
-        this.windGust = windGust;
-    }
-
-    public List<Weather> getWeather() {
-        return weather;
-    }
-
-    public void setWeather(List<Weather> weather) {
-        this.weather = weather;
-    }
-
-    public Rain getRain() {
-        return rain;
-    }
-
-    public void setRain(Rain rain) {
-        this.rain = rain;
-    }
-
-    public Snow getSnow() {
-        return snow;
-    }
-
-    public void setSnow(Snow snow) {
-        this.snow = snow;
-    }
-}
index aed23e66dc60a333a47b8bfade9f7d1e8ac09f41..5e50bacb21c248ff6db3ecd9752d93d2cef29075 100644 (file)
@@ -14,7 +14,9 @@ package org.openhab.binding.openweathermap.internal.dto.onecallhist;
 
 import java.util.List;
 
-import com.google.gson.annotations.Expose;
+import org.openhab.binding.openweathermap.internal.dto.onecall.Precipitation;
+import org.openhab.binding.openweathermap.internal.dto.onecall.Weather;
+
 import com.google.gson.annotations.SerializedName;
 
 /**
@@ -28,49 +30,25 @@ import com.google.gson.annotations.SerializedName;
  * @author Wolfgang Klimt - Initial contribution
  */
 public class Hourly {
-
-    @SerializedName("dt")
-    @Expose
     private int dt;
-    @SerializedName("temp")
-    @Expose
     private double temp;
     @SerializedName("feels_like")
-    @Expose
     private double feelsLike;
-    @SerializedName("pressure")
-    @Expose
     private int pressure;
-    @SerializedName("humidity")
-    @Expose
     private int humidity;
     @SerializedName("dew_point")
-    @Expose
     private double dewPoint;
-    @SerializedName("clouds")
-    @Expose
     private int clouds;
-    @SerializedName("visibility")
-    @Expose
     private int visibility;
     @SerializedName("wind_speed")
-    @Expose
     private double windSpeed;
     @SerializedName("wind_deg")
-    @Expose
     private int windDeg;
     @SerializedName("wind_gust")
-    @Expose
     private double windGust;
-    @SerializedName("weather")
-    @Expose
     private List<Weather> weather = null;
-    @SerializedName("rain")
-    @Expose
-    private Rain rain;
-    @SerializedName("snow")
-    @Expose
-    private Snow snow;
+    private Precipitation rain;
+    private Precipitation snow;
 
     public int getDt() {
         return dt;
@@ -168,19 +146,19 @@ public class Hourly {
         this.weather = weather;
     }
 
-    public Rain getRain() {
+    public Precipitation getRain() {
         return rain;
     }
 
-    public void setRain(Rain rain) {
+    public void setRain(Precipitation rain) {
         this.rain = rain;
     }
 
-    public Snow getSnow() {
+    public Precipitation getSnow() {
         return snow;
     }
 
-    public void setSnow(Snow snow) {
+    public void setSnow(Precipitation snow) {
         this.snow = snow;
     }
 }
diff --git a/bundles/org.openhab.binding.openweathermap/src/main/java/org/openhab/binding/openweathermap/internal/dto/onecallhist/OpenWeatherMapOneCallHistAPIData.java b/bundles/org.openhab.binding.openweathermap/src/main/java/org/openhab/binding/openweathermap/internal/dto/onecallhist/OpenWeatherMapOneCallHistAPIData.java
deleted file mode 100644 (file)
index 1840fc4..0000000
+++ /dev/null
@@ -1,98 +0,0 @@
-/**
- * Copyright (c) 2010-2022 Contributors to the openHAB project
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0
- *
- * SPDX-License-Identifier: EPL-2.0
- */
-package org.openhab.binding.openweathermap.internal.dto.onecallhist;
-
-import java.util.List;
-
-import com.google.gson.annotations.Expose;
-import com.google.gson.annotations.SerializedName;
-
-/**
- * Holds the data from the deserialised JSON response. Created using http://www.jsonschema2pojo.org/.
- * Settings:
- * Annotation Style: GSON
- * Use primitive types
- * Use double numbers
- * allow additional properties
- *
- * @author Wolfgang Klimt - Initial contribution
- */
-public class OpenWeatherMapOneCallHistAPIData {
-
-    @SerializedName("lat")
-    @Expose
-    private double lat;
-    @SerializedName("lon")
-    @Expose
-    private double lon;
-    @SerializedName("timezone")
-    @Expose
-    private String timezone;
-    @SerializedName("timezone_offset")
-    @Expose
-    private int timezoneOffset;
-    @SerializedName("current")
-    @Expose
-    private Current current;
-    @SerializedName("hourly")
-    @Expose
-    private List<Hourly> hourly = null;
-
-    public double getLat() {
-        return lat;
-    }
-
-    public void setLat(double lat) {
-        this.lat = lat;
-    }
-
-    public double getLon() {
-        return lon;
-    }
-
-    public void setLon(double lon) {
-        this.lon = lon;
-    }
-
-    public String getTimezone() {
-        return timezone;
-    }
-
-    public void setTimezone(String timezone) {
-        this.timezone = timezone;
-    }
-
-    public int getTimezoneOffset() {
-        return timezoneOffset;
-    }
-
-    public void setTimezoneOffset(int timezoneOffset) {
-        this.timezoneOffset = timezoneOffset;
-    }
-
-    public Current getCurrent() {
-        return current;
-    }
-
-    public void setCurrent(Current current) {
-        this.current = current;
-    }
-
-    public List<Hourly> getHourly() {
-        return hourly;
-    }
-
-    public void setHourly(List<Hourly> hourly) {
-        this.hourly = hourly;
-    }
-}
diff --git a/bundles/org.openhab.binding.openweathermap/src/main/java/org/openhab/binding/openweathermap/internal/dto/onecallhist/Rain.java b/bundles/org.openhab.binding.openweathermap/src/main/java/org/openhab/binding/openweathermap/internal/dto/onecallhist/Rain.java
deleted file mode 100644 (file)
index f29053a..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-/**
- * Copyright (c) 2010-2022 Contributors to the openHAB project
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0
- *
- * SPDX-License-Identifier: EPL-2.0
- */
-package org.openhab.binding.openweathermap.internal.dto.onecallhist;
-
-import com.google.gson.annotations.Expose;
-import com.google.gson.annotations.SerializedName;
-
-/**
- * Holds the data from the deserialised JSON response. Created using http://www.jsonschema2pojo.org/.
- * Settings:
- * Annotation Style: GSON
- * Use primitive types
- * Use double numbers
- * allow additional properties
- *
- * @author Wolfgang Klimt - Initial contribution
- */
-public class Rain {
-
-    @SerializedName("1h")
-    @Expose
-    private double _1h;
-
-    public double get1h() {
-        return _1h;
-    }
-
-    public void set1h(double _1h) {
-        this._1h = _1h;
-    }
-}
diff --git a/bundles/org.openhab.binding.openweathermap/src/main/java/org/openhab/binding/openweathermap/internal/dto/onecallhist/Snow.java b/bundles/org.openhab.binding.openweathermap/src/main/java/org/openhab/binding/openweathermap/internal/dto/onecallhist/Snow.java
deleted file mode 100644 (file)
index c624325..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-/**
- * Copyright (c) 2010-2022 Contributors to the openHAB project
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0
- *
- * SPDX-License-Identifier: EPL-2.0
- */
-package org.openhab.binding.openweathermap.internal.dto.onecallhist;
-
-import com.google.gson.annotations.Expose;
-import com.google.gson.annotations.SerializedName;
-
-/**
- * Holds the data from the deserialised JSON response. Created using http://www.jsonschema2pojo.org/.
- * Settings:
- * Annotation Style: GSON
- * Use primitive types
- * Use double numbers
- * allow additional properties
- *
- * @author Wolfgang Klimt - Initial contribution
- */
-public class Snow {
-
-    @SerializedName("1h")
-    @Expose
-    private double _1h;
-
-    public double get1h() {
-        return _1h;
-    }
-
-    public void set1h(double _1h) {
-        this._1h = _1h;
-    }
-}
diff --git a/bundles/org.openhab.binding.openweathermap/src/main/java/org/openhab/binding/openweathermap/internal/dto/onecallhist/Weather.java b/bundles/org.openhab.binding.openweathermap/src/main/java/org/openhab/binding/openweathermap/internal/dto/onecallhist/Weather.java
deleted file mode 100644 (file)
index b32a847..0000000
+++ /dev/null
@@ -1,74 +0,0 @@
-/**
- * Copyright (c) 2010-2022 Contributors to the openHAB project
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0
- *
- * SPDX-License-Identifier: EPL-2.0
- */
-package org.openhab.binding.openweathermap.internal.dto.onecallhist;
-
-import com.google.gson.annotations.Expose;
-import com.google.gson.annotations.SerializedName;
-
-/**
- * Holds the data from the deserialised JSON response. Created using http://www.jsonschema2pojo.org/.
- * Settings:
- * Annotation Style: GSON
- * Use primitive types
- * Use double numbers
- * allow additional properties
- *
- * @author Wolfgang Klimt - Initial contribution
- */
-public class Weather {
-
-    @SerializedName("id")
-    @Expose
-    private int id;
-    @SerializedName("main")
-    @Expose
-    private String main;
-    @SerializedName("description")
-    @Expose
-    private String description;
-    @SerializedName("icon")
-    @Expose
-    private String icon;
-
-    public int getId() {
-        return id;
-    }
-
-    public void setId(int id) {
-        this.id = id;
-    }
-
-    public String getMain() {
-        return main;
-    }
-
-    public void setMain(String main) {
-        this.main = main;
-    }
-
-    public String getDescription() {
-        return description;
-    }
-
-    public void setDescription(String description) {
-        this.description = description;
-    }
-
-    public String getIcon() {
-        return icon;
-    }
-
-    public void setIcon(String icon) {
-        this.icon = icon;
-    }
-}
index 625e458361ace8c3c00275ca09db73c03ee1c763..7c7611d3961494e89c77b5f4447ab2b31fa6c84e 100644 (file)
@@ -26,12 +26,11 @@ import org.eclipse.jdt.annotation.NonNullByDefault;
 import org.eclipse.jdt.annotation.Nullable;
 import org.openhab.binding.openweathermap.internal.config.OpenWeatherMapOneCallConfiguration;
 import org.openhab.binding.openweathermap.internal.connection.OpenWeatherMapConnection;
+import org.openhab.binding.openweathermap.internal.dto.OpenWeatherMapOneCallAPIData;
+import org.openhab.binding.openweathermap.internal.dto.forecast.daily.FeelsLikeTemp;
+import org.openhab.binding.openweathermap.internal.dto.forecast.daily.Temp;
 import org.openhab.binding.openweathermap.internal.dto.onecall.Alert;
-import org.openhab.binding.openweathermap.internal.dto.onecall.FeelsLike;
-import org.openhab.binding.openweathermap.internal.dto.onecall.OpenWeatherMapOneCallAPIData;
-import org.openhab.binding.openweathermap.internal.dto.onecall.Rain;
-import org.openhab.binding.openweathermap.internal.dto.onecall.Snow;
-import org.openhab.binding.openweathermap.internal.dto.onecall.Temp;
+import org.openhab.binding.openweathermap.internal.dto.onecall.Precipitation;
 import org.openhab.core.i18n.CommunicationException;
 import org.openhab.core.i18n.ConfigurationException;
 import org.openhab.core.i18n.TimeZoneProvider;
@@ -348,11 +347,11 @@ public class OpenWeatherMapOneCallHandler extends AbstractOpenWeatherMapHandler
                     state = getDecimalTypeState(localWeatherData.getCurrent().getUvi());
                     break;
                 case CHANNEL_RAIN:
-                    Rain rain = localWeatherData.getCurrent().getRain();
+                    Precipitation rain = localWeatherData.getCurrent().getRain();
                     state = getQuantityTypeState(rain == null ? 0 : rain.get1h(), MILLI(METRE));
                     break;
                 case CHANNEL_SNOW:
-                    Snow snow = localWeatherData.getCurrent().getSnow();
+                    Precipitation snow = localWeatherData.getCurrent().getSnow();
                     state = getQuantityTypeState(snow == null ? 0 : snow.get1h(), MILLI(METRE));
                     break;
                 case CHANNEL_VISIBILITY:
@@ -487,11 +486,11 @@ public class OpenWeatherMapOneCallHandler extends AbstractOpenWeatherMapHandler
                     state = getQuantityTypeState(forecastData.getPop() * 100.0, PERCENT);
                     break;
                 case CHANNEL_RAIN:
-                    Rain rain = forecastData.getRain();
+                    Precipitation rain = forecastData.getRain();
                     state = getQuantityTypeState(rain == null ? 0 : rain.get1h(), MILLI(METRE));
                     break;
                 case CHANNEL_SNOW:
-                    Snow snow = forecastData.getSnow();
+                    Precipitation snow = forecastData.getSnow();
                     state = getQuantityTypeState(snow == null ? 0 : snow.get1h(), MILLI(METRE));
                     break;
                 default:
@@ -527,7 +526,7 @@ public class OpenWeatherMapOneCallHandler extends AbstractOpenWeatherMapHandler
                     .get(count);
             State state = UnDefType.UNDEF;
             Temp temp;
-            FeelsLike feelsLike;
+            FeelsLikeTemp feelsLike;
             switch (channelId) {
                 case CHANNEL_TIME_STAMP:
                     state = getDateTimeTypeState(forecastData.getDt());
index ac31e253aef7f6c1bf0160d8515891fe6e7b48bd..51d015a9718455a6d1693f0ba8fd1580ebdf990f 100644 (file)
@@ -24,10 +24,9 @@ import org.eclipse.jdt.annotation.NonNullByDefault;
 import org.eclipse.jdt.annotation.Nullable;
 import org.openhab.binding.openweathermap.internal.config.OpenWeatherMapOneCallHistoryConfiguration;
 import org.openhab.binding.openweathermap.internal.connection.OpenWeatherMapConnection;
+import org.openhab.binding.openweathermap.internal.dto.OpenWeatherMapOneCallHistAPIData;
+import org.openhab.binding.openweathermap.internal.dto.onecall.Precipitation;
 import org.openhab.binding.openweathermap.internal.dto.onecallhist.Hourly;
-import org.openhab.binding.openweathermap.internal.dto.onecallhist.OpenWeatherMapOneCallHistAPIData;
-import org.openhab.binding.openweathermap.internal.dto.onecallhist.Rain;
-import org.openhab.binding.openweathermap.internal.dto.onecallhist.Snow;
 import org.openhab.core.i18n.CommunicationException;
 import org.openhab.core.i18n.ConfigurationException;
 import org.openhab.core.i18n.TimeZoneProvider;
@@ -198,11 +197,11 @@ public class OpenWeatherMapOneCallHistoryHandler extends AbstractOpenWeatherMapH
                     state = getDecimalTypeState(localWeatherData.getCurrent().getUvi());
                     break;
                 case CHANNEL_RAIN:
-                    Rain rain = localWeatherData.getCurrent().getRain();
+                    Precipitation rain = localWeatherData.getCurrent().getRain();
                     state = getQuantityTypeState(rain == null ? 0 : rain.get1h(), MILLI(METRE));
                     break;
                 case CHANNEL_SNOW:
-                    Snow snow = localWeatherData.getCurrent().getSnow();
+                    Precipitation snow = localWeatherData.getCurrent().getSnow();
                     state = getQuantityTypeState(snow == null ? 0 : snow.get1h(), MILLI(METRE));
                     break;
                 case CHANNEL_VISIBILITY:
@@ -295,11 +294,11 @@ public class OpenWeatherMapOneCallHistoryHandler extends AbstractOpenWeatherMapH
                     State tempstate = new QuantityType<>(historyData.getVisibility(), METRE).toUnit(KILO(METRE));
                     state = (tempstate == null ? state : tempstate);
                 case CHANNEL_RAIN:
-                    Rain rain = historyData.getRain();
+                    Precipitation rain = historyData.getRain();
                     state = getQuantityTypeState(rain == null ? 0 : rain.get1h(), MILLI(METRE));
                     break;
                 case CHANNEL_SNOW:
-                    Snow snow = historyData.getSnow();
+                    Precipitation snow = historyData.getSnow();
                     state = getQuantityTypeState(snow == null ? 0 : snow.get1h(), MILLI(METRE));
                     break;
                 default:
index 6ade3a2d5bf7744f9339de015532e1dd7fc94514..741603f290acdc8241eb1ac361428a1e8c50b13d 100644 (file)
@@ -31,8 +31,7 @@ import org.openhab.binding.openweathermap.internal.connection.OpenWeatherMapConn
 import org.openhab.binding.openweathermap.internal.dto.OpenWeatherMapJsonDailyForecastData;
 import org.openhab.binding.openweathermap.internal.dto.OpenWeatherMapJsonHourlyForecastData;
 import org.openhab.binding.openweathermap.internal.dto.OpenWeatherMapJsonWeatherData;
-import org.openhab.binding.openweathermap.internal.dto.base.Rain;
-import org.openhab.binding.openweathermap.internal.dto.base.Snow;
+import org.openhab.binding.openweathermap.internal.dto.base.Precipitation;
 import org.openhab.binding.openweathermap.internal.dto.forecast.daily.FeelsLikeTemp;
 import org.openhab.core.config.core.Configuration;
 import org.openhab.core.i18n.CommunicationException;
@@ -301,11 +300,11 @@ public class OpenWeatherMapWeatherAndForecastHandler extends AbstractOpenWeather
                     state = getQuantityTypeState(localWeatherData.getClouds().getAll(), PERCENT);
                     break;
                 case CHANNEL_RAIN:
-                    Rain rain = localWeatherData.getRain();
+                    Precipitation rain = localWeatherData.getRain();
                     state = getQuantityTypeState(rain == null ? 0 : rain.getVolume(), MILLI(METRE));
                     break;
                 case CHANNEL_SNOW:
-                    Snow snow = localWeatherData.getSnow();
+                    Precipitation snow = localWeatherData.getSnow();
                     state = getQuantityTypeState(snow == null ? 0 : snow.getVolume(), MILLI(METRE));
                     break;
                 case CHANNEL_VISIBILITY:
@@ -395,11 +394,11 @@ public class OpenWeatherMapWeatherAndForecastHandler extends AbstractOpenWeather
                     state = getQuantityTypeState(forecastData.getClouds().getAll(), PERCENT);
                     break;
                 case CHANNEL_RAIN:
-                    Rain rain = forecastData.getRain();
+                    Precipitation rain = forecastData.getRain();
                     state = getQuantityTypeState(rain == null ? 0 : rain.getVolume(), MILLI(METRE));
                     break;
                 case CHANNEL_SNOW:
-                    Snow snow = forecastData.getSnow();
+                    Precipitation snow = forecastData.getSnow();
                     state = getQuantityTypeState(snow == null ? 0 : snow.getVolume(), MILLI(METRE));
                     break;
             }
@@ -462,7 +461,7 @@ public class OpenWeatherMapWeatherAndForecastHandler extends AbstractOpenWeather
                     state = getQuantityTypeState(forecastData.getTemp().getMax(), CELSIUS);
                     break;
                 case CHANNEL_APPARENT_TEMPERATURE:
-                    FeelsLikeTemp feelsLikeTemp = forecastData.getFeelsLikeTemp();
+                    FeelsLikeTemp feelsLikeTemp = forecastData.getFeelsLike();
                     if (feelsLikeTemp != null) {
                         state = getQuantityTypeState(feelsLikeTemp.getDay(), CELSIUS);
                     }