Package dev.galasa.framework.api.common
Class QueryParameters
java.lang.Object
dev.galasa.framework.api.common.QueryParameters
A wrapper for a map of query parameters, with methods for extracting
and verifying the parameter contents.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
checkAtLeastOneQueryParameterPresent
(String... queryParameters) getMultipleString
(String queryParameterName, List<String> defaultValues) boolean
getSingleBoolean
(String queryParameterName, boolean defaultValue) getSingleInstant
(String queryParameterName, Instant defaultValue) int
getSingleInt
(String queryParameterName, int defaultValue) getSingleString
(String queryParameterName, String defaultValue) int
getSize()
boolean
isParameterPresent
(String queryParameter)
-
Constructor Details
-
QueryParameters
- 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 parameterdefaultValue
-- Returns:
- Throws:
InternalServletException
- when there are multiple instances of the key, with error GAL5006
-
getMultipleString
-
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 ofdefaultValue
- 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
-
checkAtLeastOneQueryParameterPresent
public boolean checkAtLeastOneQueryParameterPresent(String... queryParameters) throws InternalServletException - Throws:
InternalServletException
-
getSize
public int getSize()
-