Created
July 24, 2014 13:38
-
-
Save jeje/ed94e0084ce1c935d11a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class WeatherRequest { | |
private LocationType locationType; | |
private Float[] coordinates; | |
private String zipCode; | |
private String city; | |
private String state; | |
private String country; | |
private Locale locale; | |
public WeatherRequest forCoordinates(Float coordinateX, Float coordinateY) { | |
this.coordinates = new Float[]{coordinateX, coordinateY}; | |
this.locationType = LocationType.COORDINATES; | |
return this; | |
} | |
public WeatherRequest forZipCode(String zipCode) { | |
this.zipCode = zipCode; | |
this.locationType = LocationType.ZIPCODE; | |
return this; | |
} | |
public WeatherRequest forCityInState(String city, String state) { | |
this.city = city; | |
this.state = state; | |
this.locationType = LocationType.CITY_STATE; | |
return this; | |
} | |
public WeatherRequest forCityInCountry(String city, String country) { | |
this.city = city; | |
this.country = country; | |
this.locationType = LocationType.CITY_COUNTRY; | |
return this; | |
} | |
public WeatherRequest forLocalIP() { | |
this.locationType = LocationType.AUTO_IP; | |
return this; | |
} | |
public WeatherRequest withLocale(Locale locale) { | |
this.locale = locale; | |
return this; | |
} | |
public LocationType getLocationType() { | |
return locationType; | |
} | |
public Float[] getCoordinates() { | |
return coordinates; | |
} | |
public String getZipCode() { | |
return zipCode; | |
} | |
public String getCity() { | |
return city; | |
} | |
public String getState() { | |
return state; | |
} | |
public String getCountry() { | |
return country; | |
} | |
public Locale getLocale() { | |
return locale; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment