public static class

WeatherInfo.Builder

extends Object
java.lang.Object
   ↳ lineageos.weather.WeatherInfo.Builder

Class Overview

Builder class for WeatherInfo

Summary

Public Constructors
WeatherInfo.Builder(String cityName, double temperature, int tempUnit)
Public Methods
WeatherInfo build()
Combine all of the options that have been set and return a new WeatherInfo object
WeatherInfo.Builder setForecast(List<WeatherInfo.DayForecast> forecasts)
WeatherInfo.Builder setHumidity(double humidity)
WeatherInfo.Builder setTimestamp(long timeStamp)
WeatherInfo.Builder setTodaysHigh(double todaysHigh)
WeatherInfo.Builder setTodaysLow(double todaysLow)
WeatherInfo.Builder setWeatherCondition(int conditionCode)
WeatherInfo.Builder setWind(double windSpeed, double windDirection, int windSpeedUnit)
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public WeatherInfo.Builder (String cityName, double temperature, int tempUnit)

added in API level 5

Parameters
cityName String: A valid city name. Attempting to pass null will get you an IllegalArgumentException
temperature double: A valid temperature value. Attempting pass an invalid double value, will get you an IllegalArgumentException
tempUnit int: A valid temperature unit value. See WeatherContract.WeatherColumns.TempUnit for valid values. Attempting to pass an invalid temperature unit will get you an IllegalArgumentException

Public Methods

public WeatherInfo build ()

added in API level 5

Combine all of the options that have been set and return a new WeatherInfo object

Returns
WeatherInfo WeatherInfo

public WeatherInfo.Builder setForecast (List<WeatherInfo.DayForecast> forecasts)

added in API level 5

Parameters
forecasts List: A valid array list of WeatherInfo.DayForecast objects. Attempting to pass null will get you an IllegalArgumentException'
Returns
WeatherInfo.Builder The WeatherInfo.Builder instance

public WeatherInfo.Builder setHumidity (double humidity)

added in API level 5

Parameters
humidity double: The weather humidity. Attempting to pass an invalid double value will get you an IllegalArgumentException
Returns
WeatherInfo.Builder The WeatherInfo.Builder instance

public WeatherInfo.Builder setTimestamp (long timeStamp)

added in API level 5

Parameters
timeStamp long: A timestamp indicating when this data was generated. If timestamps is not set, then the builder will set it to the time of object creation
Returns
WeatherInfo.Builder The WeatherInfo.Builder instance

public WeatherInfo.Builder setTodaysHigh (double todaysHigh)

added in API level 5

Parameters
todaysHigh double: Today's high temperature. Attempting to pass an invalid double value will get you an IllegalArgumentException
Returns
WeatherInfo.Builder The WeatherInfo.Builder instance

public WeatherInfo.Builder setTodaysLow (double todaysLow)

added in API level 5

Parameters
todaysLow double: Today's low temperature. Attempting to pass an invalid double value will get you an IllegalArgumentException
Returns
WeatherInfo.Builder

public WeatherInfo.Builder setWeatherCondition (int conditionCode)

added in API level 5

Parameters
conditionCode int: A valid weather condition code. See WeatherContract.WeatherColumns.WeatherCode for valid codes. Attempting to pass an invalid code will get you an IllegalArgumentException.
Returns
WeatherInfo.Builder The WeatherInfo.Builder instance

public WeatherInfo.Builder setWind (double windSpeed, double windDirection, int windSpeedUnit)

added in API level 5

Parameters
windSpeed double: The wind speed. Attempting to pass an invalid double value will get you an IllegalArgumentException
windDirection double: The wind direction. Attempting to pass an invalid double value will get you an IllegalArgumentException
windSpeedUnit int: A valid wind speed direction unit. See WeatherContract.WeatherColumns.WindSpeedUnit for valid values. Attempting to pass an invalid speed unit will get you an IllegalArgumentException
Returns
WeatherInfo.Builder The WeatherInfo.Builder instance