Class ParameterBuilder


  • public class ParameterBuilder
    extends Object
    Parameter builder for increasing ease of adding parameters to an AerisRequest.
    • Constructor Detail

      • ParameterBuilder

        public ParameterBuilder()
        Construct an instance of the parameter builder for increasing ease of adding parameters to an AerisRequest.
    • Method Detail

      • withFields

        public ParameterBuilder withFields​(CodedInterface... fields)
        Add fields to the parameter
        Parameters:
        fields - array of Coded fields to use.
        Returns:
        field parameter with the fields
      • withFields

        public ParameterBuilder withFields​(String... fields)
        Add a fields parameter
        Parameters:
        fields - array of String fields to use.
        Returns:
        field parameter with the fields
      • withFilter

        public ParameterBuilder withFilter​(String filter)
        Construct a filter parameter with a string as the value.
        filter=:string
        Parameters:
        filter - String filter to use.
        Returns:
        ParameterBuilder obj
      • withFrom

        public ParameterBuilder withFrom​(String value)
        Constructs the from parameter 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 - double
        longitude - 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 - double
        leftLon - double
        botLat - double
        rightLon - 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 a place parameter with a fips code.
        Parameters:
        fipsCode - int
        Returns:
        ParameterBuilder obj
      • withPLimit

        public ParameterBuilder withPLimit​(int value)
        Adds a periods limit parameter 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 a period sort parameter 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 a query parameter 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 advanced query parameter with a comparator.
        Parameters:
        type - type to use, often a field name
        value - value to use as a comparator to the type
        Returns:
        ParameterBuilder obj
      • withRadius

        public ParameterBuilder withRadius​(int distance)
        Adds a radius parameter 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 a radius parameter of a certain distance.
        Parameters:
        distance - distance to use.
        unit - unit type to use
        Returns:
        ParameterBuilder obj
      • withRadius

        public ParameterBuilder withRadius​(String value)
        Adds a radius parameter with the string as the value.
        Parameters:
        value - value to use
        Returns:
        ParameterBuilder obj
      • withSort

        public ParameterBuilder withSort​(String value)
        Adds a sort parameter with the value.
        Parameters:
        value - value to use to sort with
        Returns:
        ParameterBuilder obj
      • withTo

        public ParameterBuilder withTo​(String value)
        Adds the to parameter 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 a limit parameter 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 the AerisRequest.
        Returns:
        Parameter array