Exemplo n.º 1
0
  private void collectParameters(RequestMappingContext context) {

    HandlerMethod handlerMethod = context.getHandlerMethod();
    Method method = handlerMethod.getMethod();

    LOG.debug(
        "Reading parameters models for handlerMethod |{}|", handlerMethod.getMethod().getName());

    HandlerMethodResolver handlerMethodResolver = new HandlerMethodResolver(typeResolver);
    List<ResolvedMethodParameter> parameterTypes =
        handlerMethodResolver.methodParameters(handlerMethod);
    for (ResolvedMethodParameter parameterType : parameterTypes) {
      Annotation[] parameterAnnotations =
          parameterType.getMethodParameter().getParameterAnnotations();
      for (Annotation annotation : parameterAnnotations) {
        if (annotation instanceof RequestBody || annotation instanceof RequestPart) {
          ResolvedType modelType = context.alternateFor(parameterType.getResolvedParameterType());
          LOG.debug(
              "Adding input parameter of type {}", resolvedTypeSignature(modelType).or("<null>"));
          context.operationModelsBuilder().addInputParam(modelType);
        }
      }
    }
    LOG.debug(
        "Finished reading parameters models for handlerMethod |{}|",
        handlerMethod.getMethod().getName());
  }
Exemplo n.º 2
0
 private void collectFromReturnType(RequestMappingContext context) {
   ResolvedType modelType =
       new HandlerMethodResolver(typeResolver).methodReturnType(context.getHandlerMethod());
   modelType = context.alternateFor(modelType);
   LOG.debug("Adding return parameter of type {}", resolvedTypeSignature(modelType).or("<null>"));
   context.operationModelsBuilder().addReturn(modelType);
 }