Class ParameterBuilder
- java.lang.Object
 - 
- com.aerisweather.aeris.communication.parameter.ParameterBuilder
 
 
- 
public class ParameterBuilder extends Object
Parameter builder for increasing ease of adding parameters to anAerisRequest. 
- 
- 
Constructor Summary
Constructors Constructor Description ParameterBuilder()Construct an instance of the parameter builder for increasing ease of adding parameters to anAerisRequest. 
- 
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Parameter[]build()Builds the parameters into an array of parameters used to pass into theAerisRequest.ParameterBuilderwithCustomParameter(String key, String value)Adds a custom parameter with the given key and value
key=:valueParameterBuilderwithFields(CodedInterface... fields)Addfieldsto the parameterParameterBuilderwithFields(String... fields)Add afieldsparameterParameterBuilderwithFilter(String filter)Construct afilterparameter with a string as the value.ParameterBuilderwithFrom(String value)Constructs thefromparameter with the value.
from=:stringParameterBuilderwithLimit(int limit)Adds alimitparameter to limit the number of requests.ParameterBuilderwithPlace()Adds a {PlaceParameter place} parameter by using the IP address for the location.ParameterBuilderwithPlace(double latitude, double longitude)Adds a {PlaceParameter place} parameter with latitude and longitude coordinatesParameterBuilderwithPlace(double topLat, double leftLon, double botLat, double rightLon)Adds a {PlaceParameter place} parameter with latitude and longitude coordinates to use with a {EndpointType WITHIN}.ParameterBuilderwithPlace(int fipsCode)Adds aplaceparameter with a fips code.ParameterBuilderwithPlace(android.content.Context context)Adds a {PlaceParameter place} parameter and uses the phones location, if available.ParameterBuilderwithPlace(AerisLocation... locs)Adds a {PlaceParameter place} parameter based on a polygon.ParameterBuilderwithPlace(String value)Adds a PlaceParameter parameter with a value.ParameterBuilderwithPlace(List<AerisLocation> locs)Adds a {PlaceParameter place} parameter based on a polygon.ParameterBuilderwithPLimit(int value)Adds aperiods limitparameter with number of periods to limit to.ParameterBuilderwithPSort(String value)Adds aperiod sortparameter with will sort the periods based on a value.ParameterBuilderwithQuery(String value)Adds aqueryparameter with the string value.ParameterBuilderwithQuery(String type, String value)Adds a more advancedqueryparameter with a comparator.ParameterBuilderwithRadius(int distance)Adds aradiusparameter of a certain distance.ParameterBuilderwithRadius(int distance, RadiusUnit unit)Adds aradiusparameter of a certain distance.ParameterBuilderwithRadius(String value)Adds aradiusparameter with the string as the value.ParameterBuilderwithSort(String value)Adds asortparameter with the value.ParameterBuilderwithTo(String value)Adds thetoparameter with the given value. 
 - 
 
- 
- 
Constructor Detail
- 
ParameterBuilder
public ParameterBuilder()
Construct an instance of the parameter builder for increasing ease of adding parameters to anAerisRequest. 
 - 
 
- 
Method Detail
- 
withFields
public ParameterBuilder withFields(CodedInterface... fields)
Addfieldsto the parameter- Parameters:
 fields- array of Coded fields to use.- Returns:
 - field parameter with the fields
 
 
- 
withFields
public ParameterBuilder withFields(String... fields)
Add afieldsparameter- Parameters:
 fields- array of String fields to use.- Returns:
 - field parameter with the fields
 
 
- 
withFilter
public ParameterBuilder withFilter(String filter)
Construct afilterparameter with a string as the value.
filter=:string- Parameters:
 filter- String filter to use.- Returns:
 - ParameterBuilder obj
 
 
- 
withFrom
public ParameterBuilder withFrom(String value)
Constructs thefromparameter with the value.
from=:string- Parameters:
 value- value to use- Returns:
 - ParameterBuilder obj
 
 
- 
withPlace
public ParameterBuilder withPlace(String value)
Adds a PlaceParameter parameter with a value. There are many supported values. All spaces are replaces with + signs automatically
City state: seattle,wa | seattle,washington | new+york,new+york
City, state, country: seattle,wa,us | toronto,on,ca
City Country: paris,fr | paris,france
Zip code/postal code: 98109 | 55415 | M3C4H9
3 Char IATA Airport Codes: MSP | ROA
County/parish king+county,wa State-county id: WAC033
NOAA public weather zone: MNZ029- Parameters:
 value- ParameterBuilder obj- Returns:
 - ParameterBuilder obj
 
 
- 
withPlace
public ParameterBuilder withPlace(double latitude, double longitude)
Adds a {PlaceParameter place} parameter with latitude and longitude coordinates- Parameters:
 latitude- doublelongitude- double- Returns:
 - ParameterBuilder obj
 
 
- 
withPlace
public ParameterBuilder withPlace(double topLat, double leftLon, double botLat, double rightLon)
Adds a {PlaceParameter place} parameter with latitude and longitude coordinates to use with a {EndpointType WITHIN}.- Parameters:
 topLat- doubleleftLon- doublebotLat- doublerightLon- double- Returns:
 - ParameterBuilder obj
 
 
- 
withPlace
public ParameterBuilder withPlace()
Adds a {PlaceParameter place} parameter by using the IP address for the location.- Returns:
 - ParameterBuilder obj
 
 
- 
withPlace
public ParameterBuilder withPlace(android.content.Context context)
Adds a {PlaceParameter place} parameter and uses the phones location, if available. If not, will query location based on the IP.- Parameters:
 context- ParameterBuilder- Returns:
 - ParameterBuilder obj
 
 
- 
withPlace
public ParameterBuilder withPlace(AerisLocation... locs)
Adds a {PlaceParameter place} parameter based on a polygon. Must include at least 3 locations.- Parameters:
 locs- locations to use as a polygon.- Returns:
 - ParameterBuilder obj
 
 
- 
withPlace
public ParameterBuilder withPlace(List<AerisLocation> locs)
Adds a {PlaceParameter place} parameter based on a polygon. Must include at least 3 locations.- Parameters:
 locs- locations to use as a polygon.- Returns:
 - ParameterBuilder obj
 
 
- 
withPlace
public ParameterBuilder withPlace(int fipsCode)
Adds aplaceparameter with a fips code.- Parameters:
 fipsCode- int- Returns:
 - ParameterBuilder obj
 
 
- 
withPLimit
public ParameterBuilder withPLimit(int value)
Adds aperiods limitparameter with number of periods to limit to.- Parameters:
 value- number of periods to limit to.- Returns:
 - ParameterBuilder obj
 
 
- 
withPSort
public ParameterBuilder withPSort(String value)
Adds aperiod sortparameter with will sort the periods based on a value.- Parameters:
 value- value to sort by.- Returns:
 - ParameterBuilder obj
 
 
- 
withQuery
public ParameterBuilder withQuery(String value)
Adds aqueryparameter with the string value.
query=:string- Parameters:
 value- value to use.- Returns:
 - ParameterBuilder obj
 
 
- 
withQuery
public ParameterBuilder withQuery(String type, String value)
Adds a more advancedqueryparameter with a comparator.- Parameters:
 type- type to use, often a field namevalue- value to use as a comparator to the type- Returns:
 - ParameterBuilder obj
 
 
- 
withRadius
public ParameterBuilder withRadius(int distance)
Adds aradiusparameter of a certain distance. Will default to meters.- Parameters:
 distance- distance to use in meters.- Returns:
 - ParameterBuilder obj
 
 
- 
withRadius
public ParameterBuilder withRadius(int distance, RadiusUnit unit)
Adds aradiusparameter of a certain distance.- Parameters:
 distance- distance to use.unit- unit type to use- Returns:
 - ParameterBuilder obj
 
 
- 
withRadius
public ParameterBuilder withRadius(String value)
Adds aradiusparameter with the string as the value.- Parameters:
 value- value to use- Returns:
 - ParameterBuilder obj
 
 
- 
withSort
public ParameterBuilder withSort(String value)
Adds asortparameter with the value.- Parameters:
 value- value to use to sort with- Returns:
 - ParameterBuilder obj
 
 
- 
withTo
public ParameterBuilder withTo(String value)
Adds thetoparameter with the given value.- Parameters:
 value- value to use- Returns:
 - ParameterBuilder obj
 
 
- 
withCustomParameter
public ParameterBuilder withCustomParameter(String key, String value)
Adds a custom parameter with the given key and value
key=:value- Parameters:
 key- key to use.value- value to use.- Returns:
 - ParameterBuilder obj
 
 
- 
withLimit
public ParameterBuilder withLimit(int limit)
Adds alimitparameter to limit the number of requests. Requests default to limit 1. A maximum of 250 results is enforced.- Parameters:
 limit- Number to limit it to- Returns:
 - ParameterBuilder obj
 
 
- 
build
public Parameter[] build()
Builds the parameters into an array of parameters used to pass into theAerisRequest.- Returns:
 - Parameter array
 
 
 - 
 
 -