/** * Extract the value for an annotated-method parameter (see package {@link * org.wicketstuff.rest.annotations.parameters}). * * @param methodParameter the current method parameter. * @param pathParameters the values of path parameters for the current request. * @param annotation the annotation for the current parameter that indicates how to retrieve the * value for the current parameter. * @param pageParameters PageParameters for the current request. * @return the extracted value. */ private Object extractParameterValue( MethodParameter methodParameter, LinkedHashMap<String, String> pathParameters, Annotation annotation, PageParameters pageParameters) { Object paramValue = null; Class<?> argClass = methodParameter.getParameterClass(); String mimeInputFormat = methodParameter.getOwnerMethod().getMimeInputFormat(); if (annotation instanceof RequestBody) paramValue = deserializeObjectFromRequest(argClass, mimeInputFormat); else if (annotation instanceof PathParam) paramValue = toObject(argClass, pathParameters.get(((PathParam) annotation).value())); else if (annotation instanceof RequestParam) paramValue = extractParameterFromQuery(pageParameters, (RequestParam) annotation, argClass); else if (annotation instanceof HeaderParam) paramValue = extractParameterFromHeader((HeaderParam) annotation, argClass); else if (annotation instanceof CookieParam) paramValue = extractParameterFromCookies((CookieParam) annotation, argClass); else if (annotation instanceof MatrixParam) paramValue = extractParameterFromMatrixParams(pageParameters, (MatrixParam) annotation, argClass); return paramValue; }