Class SortPositionRequestHandlerMethodArgumentResolver
java.lang.Object
com.broadleafcommerce.data.tracking.core.sort.SortPositionRequestHandlerMethodArgumentResolver
- All Implemented Interfaces:
org.springframework.web.method.support.HandlerMethodArgumentResolver
public class SortPositionRequestHandlerMethodArgumentResolver
extends Object
implements org.springframework.web.method.support.HandlerMethodArgumentResolver
Allows the use of
SortPositionRequest
within @RequestMapping
method parameters.
Construction of this parameter object requires the requesting URL specify an {id} path variable,
and an optional "after" request parameter. This can be used in conjunction with the annotation
UpdateSortOperation
to control the names of the id path variable and the "after" request
parameter.
By default, this will only populate a SortPositionRequest
if the method parameter
does not have the RequestBody
annotation. If it does, then a properly
JSON serialized version of SortPositionRequest
should be provided in the request body.
The id path variable and "after" request parameter will both be ignored, then.
- Author:
- Jeff Fischer, Nathan Moore (nathandmoore)
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected SortPositionRequest
buildSortPositionRequest
(org.springframework.web.context.request.NativeWebRequest req, String updateIdName, String afterIdName, String beforeIdName) protected String
IfUpdateSortOperation
is missing on the method parameter, this is used to supply a default value forSortPositionRequest.positionAfterContextId
.protected String
IfUpdateSortOperation
is missing on the method parameter, this is used to supply a default value forSortPositionRequest.positionBeforeContextId
.protected String
IfUpdateSortOperation
is missing on the method parameter, this is used to supply a default value forSortPositionRequest.updateContextId
.getPathVariables
(org.springframework.web.context.request.NativeWebRequest webRequest) resolveArgument
(org.springframework.core.MethodParameter parameter, org.springframework.web.method.support.ModelAndViewContainer mavContainer, org.springframework.web.context.request.NativeWebRequest webRequest, org.springframework.web.bind.support.WebDataBinderFactory binderFactory) boolean
supportsParameter
(org.springframework.core.MethodParameter parameter)
-
Field Details
-
DEFAULT_UPDATE_ID_NAME
- See Also:
-
DEFAULT_AFTER_ID_NAME
- See Also:
-
DEFAULT_BEFORE_ID_NAME
- See Also:
-
-
Constructor Details
-
SortPositionRequestHandlerMethodArgumentResolver
public SortPositionRequestHandlerMethodArgumentResolver()
-
-
Method Details
-
supportsParameter
public boolean supportsParameter(@NonNull org.springframework.core.MethodParameter parameter) - Specified by:
supportsParameter
in interfaceorg.springframework.web.method.support.HandlerMethodArgumentResolver
-
resolveArgument
public Object resolveArgument(org.springframework.core.MethodParameter parameter, org.springframework.web.method.support.ModelAndViewContainer mavContainer, org.springframework.web.context.request.NativeWebRequest webRequest, org.springframework.web.bind.support.WebDataBinderFactory binderFactory) - Specified by:
resolveArgument
in interfaceorg.springframework.web.method.support.HandlerMethodArgumentResolver
-
getDefaultUpdateIdName
IfUpdateSortOperation
is missing on the method parameter, this is used to supply a default value forSortPositionRequest.updateContextId
.- Returns:
- default value for the name of the path variable from which to populated
SortPositionRequest.updateContextId
.
-
getDefaultAfterIdName
IfUpdateSortOperation
is missing on the method parameter, this is used to supply a default value forSortPositionRequest.positionAfterContextId
.- Returns:
- default value for the name of the URL parameter from which to populated
SortPositionRequest.positionAfterContextId
.
-
getDefaultBeforeIdName
IfUpdateSortOperation
is missing on the method parameter, this is used to supply a default value forSortPositionRequest.positionBeforeContextId
.- Returns:
- default value for the name of the URL parameter from which to populated
SortPositionRequest.positionBeforeContextId
.
-
buildSortPositionRequest
@NonNull protected SortPositionRequest buildSortPositionRequest(org.springframework.web.context.request.NativeWebRequest req, String updateIdName, String afterIdName, String beforeIdName) -
getPathVariables
-