Skip to content

Instantly share code, notes, and snippets.

@gautier-levert
Created April 3, 2017 14:14
Show Gist options
  • Save gautier-levert/2708bfb542039f59a397b16fa19b551b to your computer and use it in GitHub Desktop.
Save gautier-levert/2708bfb542039f59a397b16fa19b551b to your computer and use it in GitHub Desktop.
Open Weather API JSON response for tests purpose
package org.mybop.weatherapplication;
import com.google.gson.annotations.SerializedName;
import java.util.List;
public class WeatherResponse {
private Coord coord;
private List<Weather> weather;
private String base;
private Main main;
private Wind wind;
private long dt;
public WeatherResponse() {
}
public Coord getCoord() {
return coord;
}
public void setCoord(Coord coord) {
this.coord = coord;
}
public List<Weather> getWeather() {
return weather;
}
public void setWeather(List<Weather> weather) {
this.weather = weather;
}
public String getBase() {
return base;
}
public void setBase(String base) {
this.base = base;
}
public Main getMain() {
return main;
}
public void setMain(Main main) {
this.main = main;
}
public Wind getWind() {
return wind;
}
public void setWind(Wind wind) {
this.wind = wind;
}
public long getDt() {
return dt;
}
public void setDt(long dt) {
this.dt = dt;
}
@Override
public String toString() {
return "WeatherResponse{" +
"coord=" + coord +
", weather=" + weather +
", base='" + base + '\'' +
", main=" + main +
", wind=" + wind +
", dt=" + dt +
'}';
}
public static class Coord {
private double lon;
private double lat;
public Coord() {
}
public double getLon() {
return lon;
}
public void setLon(double lon) {
this.lon = lon;
}
public double getLat() {
return lat;
}
public void setLat(double lat) {
this.lat = lat;
}
@Override
public String toString() {
return "Coord{" +
"lon=" + lon +
", lat=" + lat +
'}';
}
}
public static class Weather {
private int id;
private String main;
private String description;
private String icon;
public Weather() {
}
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;
}
@Override
public String toString() {
return "Weather{" +
"id=" + id +
", main='" + main + '\'' +
", description='" + description + '\'' +
", icon='" + icon + '\'' +
'}';
}
}
public static class Main {
private double temp;
private double pressure;
private int humidity;
@SerializedName("temp_min")
private double tempMin;
@SerializedName("temp_max")
private double tempMax;
@SerializedName("sea_level")
private double seaLevel;
@SerializedName("grnd_level")
private double groundLevel;
public Main() {
}
public double getTemp() {
return temp;
}
public void setTemp(double temp) {
this.temp = temp;
}
public double getPressure() {
return pressure;
}
public void setPressure(double pressure) {
this.pressure = pressure;
}
public int getHumidity() {
return humidity;
}
public void setHumidity(int humidity) {
this.humidity = humidity;
}
public double getTempMin() {
return tempMin;
}
public void setTempMin(double tempMin) {
this.tempMin = tempMin;
}
public double getTempMax() {
return tempMax;
}
public void setTempMax(double tempMax) {
this.tempMax = tempMax;
}
public double getSeaLevel() {
return seaLevel;
}
public void setSeaLevel(double seaLevel) {
this.seaLevel = seaLevel;
}
public double getGroundLevel() {
return groundLevel;
}
public void setGroundLevel(double groundLevel) {
this.groundLevel = groundLevel;
}
@Override
public String toString() {
return "Main{" +
"temp=" + temp +
", pressure=" + pressure +
", humidity=" + humidity +
", tempMin=" + tempMin +
", tempMax=" + tempMax +
", seaLevel=" + seaLevel +
", groundLevel=" + groundLevel +
'}';
}
}
private class Wind {
private double speed;
private double deg;
public Wind() {
}
public double getSpeed() {
return speed;
}
public void setSpeed(double speed) {
this.speed = speed;
}
public double getDeg() {
return deg;
}
public void setDeg(double deg) {
this.deg = deg;
}
@Override
public String toString() {
return "Wind{" +
"speed=" + speed +
", deg=" + deg +
'}';
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment