Package io.toro.martini.util
Class HandlerMethodArgumentResolverUtils
- java.lang.Object
-
- io.toro.martini.util.HandlerMethodArgumentResolverUtils
-
public final class HandlerMethodArgumentResolverUtils extends Object
Utility class fororg.springframework.web.method.support.HandlerMethodArgumentResolver
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Optional<String>getParam(String key, HttpServletRequest request)Retrieves the parameter's value from theHttpServletRequest.static List<String>getParamAsList(String key, HttpServletRequest request)Retrieves the parameter's values from theHttpServletRequest.static <T> List<T>getParamAsList(String key, HttpServletRequest request, Function<String,T> fn)Retrieves the parameter's values from theHttpServletRequest.static <T> List<T>toList(String[] val, Function<String,T> fn)Converts the string array toHandlerMethodArgumentResolverUtilsusing the providedFunction.
-
-
-
Method Detail
-
getParam
public static Optional<String> getParam(String key, HttpServletRequest request)
Retrieves the parameter's value from theHttpServletRequest.- Parameters:
key- the parameter keyrequest- the request containing the parameter- Returns:
- String value of the parameter
-
getParamAsList
public static List<String> getParamAsList(String key, HttpServletRequest request)
Retrieves the parameter's values from theHttpServletRequest.- Parameters:
key- the parameter keyrequest- the request containing the parameter- Returns:
- List of string values of the parameter
-
getParamAsList
public static <T> List<T> getParamAsList(String key, HttpServletRequest request, Function<String,T> fn)
Retrieves the parameter's values from theHttpServletRequest.- Type Parameters:
T- the return type- Parameters:
key- the parameter keyrequest- the request containing the parameterfn- the function that will convert the string value toHandlerMethodArgumentResolverUtils- Returns:
- List of
HandlerMethodArgumentResolverUtilsvalues of the parameter
-
toList
public static <T> List<T> toList(String[] val, Function<String,T> fn)
Converts the string array toHandlerMethodArgumentResolverUtilsusing the providedFunction.- Type Parameters:
T- the return type- Parameters:
val- the array of string to convertfn- the function to be used in converting- Returns:
- List of
HandlerMethodArgumentResolverUtilsvalues of the parameter
-
-