public final class HandlerMethodArgumentResolverUtils extends Object
org.springframework.web.method.support.HandlerMethodArgumentResolver
Modifier and Type | Method and Description |
---|---|
static Optional<String> |
getParam(String key,
HttpServletRequest request)
Retrieves the parameter's value from the
HttpServletRequest . |
static List<String> |
getParamAsList(String key,
HttpServletRequest request)
Retrieves the parameter's values from the
HttpServletRequest . |
static <T> List<T> |
getParamAsList(String key,
HttpServletRequest request,
Function<String,T> fn)
Retrieves the parameter's values from the
HttpServletRequest . |
static <T> List<T> |
toList(String[] val,
Function<String,T> fn)
Converts the string array to
T using the provided Function . |
public static Optional<String> getParam(String key, HttpServletRequest request)
HttpServletRequest
.key
- the parameter keyrequest
- the request containing the parameterpublic static List<String> getParamAsList(String key, HttpServletRequest request)
HttpServletRequest
.key
- the parameter keyrequest
- the request containing the parameterpublic static <T> List<T> getParamAsList(String key, HttpServletRequest request, Function<String,T> fn)
HttpServletRequest
.T
- the return typekey
- the parameter keyrequest
- the request containing the parameterfn
- the function that will convert the string value to T
T
values of the parameterpublic static <T> List<T> toList(String[] val, Function<String,T> fn)
T
using the provided Function
.T
- the return typeval
- the array of string to convertfn
- the function to be used in convertingT
values of the parameterCopyright © 2020. All rights reserved.