Class QueryParameters

java.lang.Object
dev.galasa.framework.api.common.QueryParameters

public class QueryParameters extends Object
A wrapper for a map of query parameters, with methods for extracting and verifying the parameter contents.
  • Constructor Details

    • QueryParameters

      public QueryParameters(Map<String,String[]> paramMap)
      Parameters:
      paramMap - The query parameters, probably coming from the request.
  • Method Details

    • getSingleString

      public String getSingleString(String queryParameterName, String defaultValue) throws InternalServletException
      Parameters:
      queryParameterName - The query parameter
      defaultValue -
      Returns:
      Throws:
      InternalServletException - when there are multiple instances of the key, with error GAL5006
    • getMultipleString

      public List<String> getMultipleString(String queryParameterName, List<String> defaultValues)
    • getSingleInt

      public int getSingleInt(String queryParameterName, int defaultValue) throws InternalServletException
      Parameters:
      queryParameterName -
      defaultValue - Returned if there are no occurrances of the query parameter.
      Returns:
      Throws:
      InternalServletException - when there are multiple values of this query parameter, or when the value of the query parameter is not a valid integer.
    • getSingleBoolean

      public boolean getSingleBoolean(String queryParameterName, boolean defaultValue) throws InternalServletException
      Parameters:
      queryParameterName - the query parameter to retrieve the value of
      defaultValue - Returned if there are no occurrances of the query parameter.
      Returns:
      the value of the given query parameter as a boolean
      Throws:
      InternalServletException - when there are multiple values of this query parameter
    • getSingleInstant

      public Instant getSingleInstant(String queryParameterName, Instant defaultValue) throws InternalServletException
      Parameters:
      queryParameterName -
      defaultValue - Returned if there are no occurrances of the query parameter.
      Returns:
      Throws:
      InternalServletException - when there are multiple values of this query parameter, or when the value of the query parameter is not a valid date-time.
    • isParameterPresent

      public boolean isParameterPresent(String queryParameter)
    • checkAtLeastOneQueryParameterPresent

      public boolean checkAtLeastOneQueryParameterPresent(String... queryParameters) throws InternalServletException
      Throws:
      InternalServletException
    • getSize

      public int getSize()