Interface SearchQuery


public interface SearchQuery
Utility class to help with creating a query string for the SearchProvider.search(String, String) method.

Query strings will have the form: <searchString>&<param1>=<value1>&<param2>=<value2>...

Since:
2.0
See Also:
  • Field Details

  • Method Details

    • setParameter

      SearchQuery setParameter(String name, String value)
      Sets an arbitrary search parameter to the query string. If parameter with given name exists, it will be overriden
      Parameters:
      name - the search parameter name
      value - the search parameter value
      Returns:
      a reference to this query creator
    • getParameter

      String getParameter(String name)
      Returns value of the parameter
      Parameters:
      name - the parameter name
      Returns:
      the parameter value
    • append

      SearchQuery append(String query)
      Appends string query to current query object. New parameters in query will override old ones.
      Parameters:
      query - un-encoded query
      Returns:
      the created and parsed search query
    • buildQueryString

      String buildQueryString()
      Builds a url-encoded queryString to use with the SearchProvider.search(String, String) method. queryString consists of searchString and parameters.
      Returns:
      queryString created by this SearchQuery.
    • getSearchString

      String getSearchString()
      Returns:
      the original string that user is searching for. Same as buildQueryString() without parameters and not url-encoded
    • getParameter

      int getParameter(String name, int defaultValue)
      Convenient method to return integer value of parameter. If parameter does not exist, or is not parsable as Integer it returns defaultValue.
      Parameters:
      name - The parameter name
      defaultValue - The default value if that parameter is not specified
      Returns:
      the integer value