Class 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)
    • Constructor Detail

      • SortPositionRequestHandlerMethodArgumentResolver

        public SortPositionRequestHandlerMethodArgumentResolver()
    • Method Detail

      • supportsParameter

        public boolean supportsParameter​(@NonNull
                                         org.springframework.core.MethodParameter parameter)
        Specified by:
        supportsParameter in interface org.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 interface org.springframework.web.method.support.HandlerMethodArgumentResolver
      • buildSortPositionRequest

        @NonNull
        protected SortPositionRequest buildSortPositionRequest​(org.springframework.web.context.request.NativeWebRequest req,
                                                               String updateIdName,
                                                               String afterIdName,
                                                               String beforeIdName)
      • getPathVariables

        protected Map<String,​String> getPathVariables​(org.springframework.web.context.request.NativeWebRequest webRequest)