ForecastDto.java 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. package nxt.weather.controller.dto;
  2. import com.fasterxml.jackson.annotation.JsonProperty;
  3. public class ForecastDto {
  4. private final String date;
  5. private final String name;
  6. private final String condition;
  7. private final int temperatureMin;
  8. private final int temperatureMax;
  9. private final String icon;
  10. private HourlyDto[] hourly;
  11. public ForecastDto(String date, String name, String condition, int temperature_min, int temperature_max, String icon) {
  12. this(date, name, condition, temperature_min, temperature_max, icon, null);
  13. }
  14. public ForecastDto(String date, String name, String condition, int temperatureMin, int temperatureMax, String icon, HourlyDto[] hourly) {
  15. this.date = date;
  16. this.name = name;
  17. this.condition = condition;
  18. this.temperatureMin = temperatureMin;
  19. this.temperatureMax = temperatureMax;
  20. this.icon = icon;
  21. this.hourly = hourly;
  22. }
  23. public String getDate() {
  24. return date;
  25. }
  26. public String getName() {
  27. return name;
  28. }
  29. /*
  30. Indique à Jackson de nommer cette attribut prevision_general lors de la
  31. serialisation de l'objet en JSON
  32. */
  33. @JsonProperty("general_forecast")
  34. public String getCondition() {
  35. return condition;
  36. }
  37. @JsonProperty("temparature_min")
  38. public int getTemperatureMin() {
  39. return temperatureMin;
  40. }
  41. @JsonProperty("temparature_max")
  42. public int getTemperatureMax() {
  43. return temperatureMax;
  44. }
  45. public String getIcon() {
  46. return icon;
  47. }
  48. public HourlyDto[] getHourly() {
  49. return hourly;
  50. }
  51. }