public static class WeatherFetcher.Builder extends Object
Constructor and Description |
---|
WeatherFetcher.Builder() |
Modifier and Type | Method and Description |
---|---|
WeatherFetcher |
build() |
WeatherFetcher.Builder |
setApiKey(String apiKey)
Api key from worldweatheronline.com for their V2 API.
|
WeatherFetcher.Builder |
setCurrent(boolean current)
Fetch current conditions.
|
WeatherFetcher.Builder |
setDate(DateTime date)
Date to fetch weather for.
|
WeatherFetcher.Builder |
setForecast(boolean forecast)
Fetch weather forecast.
|
WeatherFetcher.Builder |
setFrequency(int timePeriod)
Frequency of forecasts, in hours.
|
WeatherFetcher.Builder |
setHttpClient(org.apache.http.impl.client.CloseableHttpClient httpClient)
HttpClient to use to fetch.
|
WeatherFetcher.Builder |
setLanguage(String language)
Language for human readable text.
|
WeatherFetcher.Builder |
setLocation(String location)
Location to fetch for.
|
WeatherFetcher.Builder |
setNumOfDays(int num_of_days)
Number of days to fetch.
|
public WeatherFetcher.Builder setApiKey(String apiKey)
apiKey
- String api key to useIllegalArgumentException
- for a null apiKeypublic WeatherFetcher.Builder setLocation(String location)
location
- String name of the location. The API will work out
the type from context.public WeatherFetcher.Builder setLanguage(String language)
language
- String ISO language codepublic WeatherFetcher.Builder setHttpClient(org.apache.http.impl.client.CloseableHttpClient httpClient)
httpClient
- CloseableHttpClient to use to connect to the APIpublic WeatherFetcher.Builder setNumOfDays(int num_of_days)
num_of_days
- int number of days to fetchpublic WeatherFetcher.Builder setDate(DateTime date)
date
- DateTime date to fetch weather for.public WeatherFetcher.Builder setForecast(boolean forecast)
forecast
- boolean true to fetch forecast, false otherwise.public WeatherFetcher.Builder setCurrent(boolean current)
current
- boolean true to fetch current conditions, false
otherwise.public WeatherFetcher.Builder setFrequency(int timePeriod)
timePeriod
- int hours between forecastspublic WeatherFetcher build()
Copyright © 2015. All rights reserved.