Examples of convertIfNecessary()


Examples of org.springframework.beans.TypeConverter.convertIfNecessary()

              argValue = resolveAutowiredArgument(methodParam, beanName, null, converter);
            }
            else if (argValue instanceof BeanMetadataElement) {
              argValue = valueResolver.resolveValueIfNecessary("factory method argument", argValue);
            }
            argsToUse[i] = converter.convertIfNecessary(argValue, paramTypes[i], methodParam);
          }
        }
      }
    }
View Full Code Here

Examples of org.springframework.validation.DataBinder.convertIfNecessary()

    ConversionService conversionService = binder.getConversionService();
    if (conversionService != null) {
      TypeDescriptor source = TypeDescriptor.valueOf(String.class);
      TypeDescriptor target = new TypeDescriptor(parameter);
      if (conversionService.canConvert(source, target)) {
        return binder.convertIfNecessary(sourceValue, parameter.getParameterType(), parameter);
      }
    }
    return null;
  }
 
View Full Code Here

Examples of org.springframework.validation.DataBinder.convertIfNecessary()

    ConversionService conversionService = binder.getConversionService();
    if (conversionService != null) {
      TypeDescriptor source = TypeDescriptor.valueOf(String.class);
      TypeDescriptor target = new TypeDescriptor(parameter);
      if (conversionService.canConvert(source, target)) {
        return binder.convertIfNecessary(sourceValue, parameter.getParameterType(), parameter);
      }
    }
    return null;
  }
 
View Full Code Here

Examples of org.springframework.web.bind.ServletRequestDataBinder.convertIfNecessary()

                    "for the corresponding primitive type.");
              }
            }
            ServletRequestDataBinder binder = createBinder(request, null, paramName);
            initBinder(handler, paramName, binder, webRequest, request, response);
            args[i] = binder.convertIfNecessary(paramValue, param.getParameterType(), param);
          }
          else {
            // Bind request parameter onto object...
            if (sessionAttributeSet != null &&
                (sessionAttributeSet.contains(attrName) || sessionAttributeSet.contains(param.getParameterType())) &&
View Full Code Here

Examples of org.springframework.web.bind.WebDataBinder.convertIfNecessary()

            "primitive type. Consider declaring it as object wrapper for the corresponding primitive type.");
      }
    }
    WebDataBinder binder = createBinder(webRequest, null, paramName);
    initBinder(handlerForInitBinderCall, paramName, binder, webRequest);
    return binder.convertIfNecessary(paramValue, paramType, methodParam);
  }

  private WebDataBinder resolveModelAttribute(String attrName, MethodParameter methodParam,
      ExtendedModelMap implicitModel, NativeWebRequest webRequest, Object handler) throws Exception {
View Full Code Here

Examples of org.springframework.web.bind.WebDataBinder.convertIfNecessary()

      arg = handleNullValue(namedValueInfo.name, arg, paramType);
    }

    if (binderFactory != null) {
      WebDataBinder binder = binderFactory.createBinder(webRequest, null, namedValueInfo.name);
      arg = binder.convertIfNecessary(arg, paramType, parameter);
    }

    handleResolvedValue(arg, namedValueInfo.name, parameter, mavContainer, webRequest);

    return arg;
View Full Code Here

Examples of org.springframework.web.bind.WebDataBinder.convertIfNecessary()

      }
      paramValue = checkValue(paramName, paramValue, paramType);
    }
    WebDataBinder binder = createBinder(webRequest, null, paramName);
    initBinder(handlerForInitBinderCall, paramName, binder, webRequest);
    return binder.convertIfNecessary(paramValue, paramType, methodParam);
  }

  private Map resolveRequestParamMap(Class<? extends Map> mapType, NativeWebRequest webRequest) {
    Map<String, String[]> parameterMap = webRequest.getParameterMap();
    if (MultiValueMap.class.isAssignableFrom(mapType)) {
View Full Code Here

Examples of org.springframework.web.bind.WebDataBinder.convertIfNecessary()

      }
      headerValue = checkValue(headerName, headerValue, paramType);
    }
    WebDataBinder binder = createBinder(webRequest, null, headerName);
    initBinder(handlerForInitBinderCall, headerName, binder, webRequest);
    return binder.convertIfNecessary(headerValue, paramType, methodParam);
  }

  private Map resolveRequestHeaderMap(Class<? extends Map> mapType, NativeWebRequest webRequest) {
    if (MultiValueMap.class.isAssignableFrom(mapType)) {
      MultiValueMap<String, String> result;
View Full Code Here

Examples of org.springframework.web.bind.WebDataBinder.convertIfNecessary()

      }
      cookieValue = checkValue(cookieName, cookieValue, paramType);
    }
    WebDataBinder binder = createBinder(webRequest, null, cookieName);
    initBinder(handlerForInitBinderCall, cookieName, binder, webRequest);
    return binder.convertIfNecessary(cookieValue, paramType, methodParam);
  }

  /**
   * Resolves the given {@link CookieValue @CookieValue} annotation.
   * <p>Throws an UnsupportedOperationException by default.
View Full Code Here

Examples of org.springframework.web.bind.WebDataBinder.convertIfNecessary()

      pathVarName = getRequiredParameterName(methodParam);
    }
    String pathVarValue = resolvePathVariable(pathVarName, paramType, webRequest);
    WebDataBinder binder = createBinder(webRequest, null, pathVarName);
    initBinder(handlerForInitBinderCall, pathVarName, binder, webRequest);
    return binder.convertIfNecessary(pathVarValue, paramType, methodParam);
  }

  /**
   * Resolves the given {@link PathVariable @PathVariable} annotation.
   * <p>Throws an UnsupportedOperationException by default.
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.