Class WeatherData


  • public class WeatherData
    extends Object
    Class representing weather data retrieved from the internet.
    Author:
    Herbert Praehofer
    • Field Detail

      • temp

        public final double temp
        The temperature value
      • humidity

        public final double humidity
        The humidity value
      • pressure

        public final double pressure
        The pressure value
      • speed

        public final double speed
        The wind speed
      • clouds

        public final String clouds
        The cloud value
    • Constructor Detail

      • WeatherData

        private WeatherData​(double temp,
                            double humidity,
                            double pressure,
                            double speed,
                            String clouds)
        Constructor.
        Parameters:
        temp - the temperature value
        humidity - the humidity value
        pressure - the pressure value
        speed - the wind speed
        clouds - the clouding
    • Method Detail

      • fromJSON

        public static WeatherData fromJSON​(String data)
        Creates an weather data object from a JSON string.
        Parameters:
        data - the JSON string
        Returns:
        the weather data object
      • getDoubleValue

        private static double getDoubleValue​(String data,
                                             String key)
      • findDataStart

        private static int findDataStart​(String data,
                                         String key)