org.springframework.web.bind.annotation.ValueConstants Java Examples
The following examples show how to use
org.springframework.web.bind.annotation.ValueConstants.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: RequestHeaderAnnotationProcessor.java From servicecomb-toolkit with Apache License 2.0 | 6 votes |
@Override public void process(RequestHeader requestHeader, ParameterContext parameterContext) { parameterContext.setIn(InType.HEADER); parameterContext.setRequired(requestHeader.required()); if (!ObjectUtils.isEmpty(requestHeader.defaultValue()) && !ValueConstants.DEFAULT_NONE .equals(requestHeader.defaultValue())) { parameterContext.setDefaultValue(requestHeader.defaultValue()); } String name = requestHeader.name(); if (StringUtils.isEmpty(name)) { name = requestHeader.value(); } parameterContext.setName(name); }
Example #2
Source File: RequestParamAnnotationProcessor.java From servicecomb-toolkit with Apache License 2.0 | 6 votes |
@Override public void process(RequestParam requestParam, ParameterContext parameterContext) { parameterContext.setIn(InType.QUERY); String name = requestParam.value(); if (StringUtils.isEmpty(name)) { name = requestParam.name(); } parameterContext.setName(name); parameterContext.setRequired(requestParam.required()); if (!ObjectUtils.isEmpty(requestParam.defaultValue()) && !ValueConstants.DEFAULT_NONE .equals(requestParam.defaultValue())) { parameterContext.setDefaultValue(requestParam.defaultValue()); parameterContext.setRequired(false); } }
Example #3
Source File: WxApiParamContributor.java From FastBootWeixin with Apache License 2.0 | 6 votes |
@Override public void contributeMethodArgument(MethodParameter parameter, Object value, UriComponentsBuilder builder, Map<String, Object> uriVariables, ConversionService conversionService) { Class<?> paramType = parameter.getNestedParameterType(); if (Map.class.isAssignableFrom(paramType)) { return; } WxApiParam wxApiParam = parameter.getParameterAnnotation(WxApiParam.class); String name = (wxApiParam == null || StringUtils.isEmpty(wxApiParam.name()) ? parameter.getParameterName() : wxApiParam.name()); WxAppAssert.notNull(name, "请添加编译器的-parameter或者为参数添加注解名称"); if (value == null) { if (wxApiParam != null) { if (!wxApiParam.required() || !wxApiParam.defaultValue().equals(ValueConstants.DEFAULT_NONE)) { return; } } builder.queryParam(name); } else if (value instanceof Collection) { for (Object element : (Collection<?>) value) { element = formatUriValue(conversionService, TypeDescriptor.nested(parameter, 1), element); builder.queryParam(name, element); } } else { builder.queryParam(name, formatUriValue(conversionService, new TypeDescriptor(parameter), value)); } }
Example #4
Source File: AbstractRequestBuilder.java From springdoc-openapi with Apache License 2.0 | 6 votes |
/** * Build param parameter. * * @param parameterInfo the parameter info * @param components the components * @param requestInfo the request info * @param jsonView the json view * @return the parameter */ private Parameter buildParam(ParameterInfo parameterInfo, Components components, RequestInfo requestInfo, JsonView jsonView) { Parameter parameter; String pName = parameterInfo.getpName(); String name = StringUtils.isBlank(requestInfo.value()) ? pName : requestInfo.value(); parameterInfo.setpName(name); if (!ValueConstants.DEFAULT_NONE.equals(requestInfo.defaultValue())) parameter = this.buildParam(requestInfo.type(), components, parameterInfo, false, requestInfo.defaultValue(), jsonView); else parameter = this.buildParam(requestInfo.type(), components, parameterInfo, requestInfo.required(), null, jsonView); return parameter; }
Example #5
Source File: MatrixVariableMapMethodArgumentResolver.java From java-technology-stack with MIT License | 5 votes |
@Override @Nullable public Object resolveArgument(MethodParameter parameter, @Nullable ModelAndViewContainer mavContainer, NativeWebRequest request, @Nullable WebDataBinderFactory binderFactory) throws Exception { @SuppressWarnings("unchecked") Map<String, MultiValueMap<String, String>> matrixVariables = (Map<String, MultiValueMap<String, String>>) request.getAttribute( HandlerMapping.MATRIX_VARIABLES_ATTRIBUTE, RequestAttributes.SCOPE_REQUEST); if (CollectionUtils.isEmpty(matrixVariables)) { return Collections.emptyMap(); } MultiValueMap<String, String> map = new LinkedMultiValueMap<>(); MatrixVariable ann = parameter.getParameterAnnotation(MatrixVariable.class); Assert.state(ann != null, "No MatrixVariable annotation"); String pathVariable = ann.pathVar(); if (!pathVariable.equals(ValueConstants.DEFAULT_NONE)) { MultiValueMap<String, String> mapForPathVariable = matrixVariables.get(pathVariable); if (mapForPathVariable == null) { return Collections.emptyMap(); } map.putAll(mapForPathVariable); } else { for (MultiValueMap<String, String> vars : matrixVariables.values()) { vars.forEach((name, values) -> { for (String value : values) { map.add(name, value); } }); } } return (isSingleValueMap(parameter) ? map.toSingleValueMap() : map); }
Example #6
Source File: MatrixVariableMapMethodArgumentResolver.java From spring-analysis-note with MIT License | 5 votes |
@Nullable @Override public Object resolveArgumentValue(MethodParameter parameter, BindingContext bindingContext, ServerWebExchange exchange) { Map<String, MultiValueMap<String, String>> matrixVariables = exchange.getAttribute(HandlerMapping.MATRIX_VARIABLES_ATTRIBUTE); if (CollectionUtils.isEmpty(matrixVariables)) { return Collections.emptyMap(); } MultiValueMap<String, String> map = new LinkedMultiValueMap<>(); MatrixVariable annotation = parameter.getParameterAnnotation(MatrixVariable.class); Assert.state(annotation != null, "No MatrixVariable annotation"); String pathVariable = annotation.pathVar(); if (!pathVariable.equals(ValueConstants.DEFAULT_NONE)) { MultiValueMap<String, String> mapForPathVariable = matrixVariables.get(pathVariable); if (mapForPathVariable == null) { return Collections.emptyMap(); } map.putAll(mapForPathVariable); } else { for (MultiValueMap<String, String> vars : matrixVariables.values()) { vars.forEach((name, values) -> { for (String value : values) { map.add(name, value); } }); } } return (isSingleValueMap(parameter) ? map.toSingleValueMap() : map); }
Example #7
Source File: RequestParamMethodArgumentResolver.java From spring-analysis-note with MIT License | 5 votes |
@Override public void contributeMethodArgument(MethodParameter parameter, @Nullable Object value, UriComponentsBuilder builder, Map<String, Object> uriVariables, ConversionService conversionService) { Class<?> paramType = parameter.getNestedParameterType(); if (Map.class.isAssignableFrom(paramType) || MultipartFile.class == paramType || Part.class == paramType) { return; } RequestParam requestParam = parameter.getParameterAnnotation(RequestParam.class); String name = (requestParam != null && StringUtils.hasLength(requestParam.name()) ? requestParam.name() : parameter.getParameterName()); Assert.state(name != null, "Unresolvable parameter name"); parameter = parameter.nestedIfOptional(); if (value instanceof Optional) { value = ((Optional<?>) value).orElse(null); } if (value == null) { if (requestParam != null && (!requestParam.required() || !requestParam.defaultValue().equals(ValueConstants.DEFAULT_NONE))) { return; } builder.queryParam(name); } else if (value instanceof Collection) { for (Object element : (Collection<?>) value) { element = formatUriValue(conversionService, TypeDescriptor.nested(parameter, 1), element); builder.queryParam(name, element); } } else { builder.queryParam(name, formatUriValue(conversionService, new TypeDescriptor(parameter), value)); } }
Example #8
Source File: AbstractNamedValueArgumentResolver.java From spring-analysis-note with MIT License | 5 votes |
/** * Create a new NamedValueInfo based on the given NamedValueInfo with * sanitized values. */ private NamedValueInfo updateNamedValueInfo(MethodParameter parameter, NamedValueInfo info) { String name = info.name; if (info.name.isEmpty()) { name = parameter.getParameterName(); if (name == null) { String type = parameter.getNestedParameterType().getName(); throw new IllegalArgumentException("Name for argument type [" + type + "] not " + "available, and parameter name information not found in class file either."); } } String defaultValue = (ValueConstants.DEFAULT_NONE.equals(info.defaultValue) ? null : info.defaultValue); return new NamedValueInfo(name, info.required, defaultValue); }
Example #9
Source File: MatrixVariableMapMethodArgumentResolver.java From spring-analysis-note with MIT License | 5 votes |
@Override @Nullable public Object resolveArgument(MethodParameter parameter, @Nullable ModelAndViewContainer mavContainer, NativeWebRequest request, @Nullable WebDataBinderFactory binderFactory) throws Exception { @SuppressWarnings("unchecked") Map<String, MultiValueMap<String, String>> matrixVariables = (Map<String, MultiValueMap<String, String>>) request.getAttribute( HandlerMapping.MATRIX_VARIABLES_ATTRIBUTE, RequestAttributes.SCOPE_REQUEST); if (CollectionUtils.isEmpty(matrixVariables)) { return Collections.emptyMap(); } MultiValueMap<String, String> map = new LinkedMultiValueMap<>(); MatrixVariable ann = parameter.getParameterAnnotation(MatrixVariable.class); Assert.state(ann != null, "No MatrixVariable annotation"); String pathVariable = ann.pathVar(); if (!pathVariable.equals(ValueConstants.DEFAULT_NONE)) { MultiValueMap<String, String> mapForPathVariable = matrixVariables.get(pathVariable); if (mapForPathVariable == null) { return Collections.emptyMap(); } map.putAll(mapForPathVariable); } else { for (MultiValueMap<String, String> vars : matrixVariables.values()) { vars.forEach((name, values) -> { for (String value : values) { map.add(name, value); } }); } } return (isSingleValueMap(parameter) ? map.toSingleValueMap() : map); }
Example #10
Source File: AbstractNamedValueMethodArgumentResolver.java From spring-analysis-note with MIT License | 5 votes |
/** * Create a new NamedValueInfo based on the given NamedValueInfo with sanitized values. */ private NamedValueInfo updateNamedValueInfo(MethodParameter parameter, NamedValueInfo info) { String name = info.name; if (info.name.isEmpty()) { name = parameter.getParameterName(); if (name == null) { throw new IllegalArgumentException( "Name for argument type [" + parameter.getNestedParameterType().getName() + "] not available, and parameter name information not found in class file either."); } } String defaultValue = (ValueConstants.DEFAULT_NONE.equals(info.defaultValue) ? null : info.defaultValue); return new NamedValueInfo(name, info.required, defaultValue); }
Example #11
Source File: MatrixVariableMapMethodArgumentResolver.java From java-technology-stack with MIT License | 5 votes |
@Nullable @Override public Object resolveArgumentValue(MethodParameter parameter, BindingContext bindingContext, ServerWebExchange exchange) { Map<String, MultiValueMap<String, String>> matrixVariables = exchange.getAttribute(HandlerMapping.MATRIX_VARIABLES_ATTRIBUTE); if (CollectionUtils.isEmpty(matrixVariables)) { return Collections.emptyMap(); } MultiValueMap<String, String> map = new LinkedMultiValueMap<>(); MatrixVariable annotation = parameter.getParameterAnnotation(MatrixVariable.class); Assert.state(annotation != null, "No MatrixVariable annotation"); String pathVariable = annotation.pathVar(); if (!pathVariable.equals(ValueConstants.DEFAULT_NONE)) { MultiValueMap<String, String> mapForPathVariable = matrixVariables.get(pathVariable); if (mapForPathVariable == null) { return Collections.emptyMap(); } map.putAll(mapForPathVariable); } else { for (MultiValueMap<String, String> vars : matrixVariables.values()) { vars.forEach((name, values) -> { for (String value : values) { map.add(name, value); } }); } } return (isSingleValueMap(parameter) ? map.toSingleValueMap() : map); }
Example #12
Source File: AbstractNamedValueArgumentResolver.java From java-technology-stack with MIT License | 5 votes |
/** * Create a new NamedValueInfo based on the given NamedValueInfo with * sanitized values. */ private NamedValueInfo updateNamedValueInfo(MethodParameter parameter, NamedValueInfo info) { String name = info.name; if (info.name.isEmpty()) { name = parameter.getParameterName(); if (name == null) { String type = parameter.getNestedParameterType().getName(); throw new IllegalArgumentException("Name for argument type [" + type + "] not " + "available, and parameter name information not found in class file either."); } } String defaultValue = (ValueConstants.DEFAULT_NONE.equals(info.defaultValue) ? null : info.defaultValue); return new NamedValueInfo(name, info.required, defaultValue); }
Example #13
Source File: ParamFromRequestParamBuilder.java From wadl-tools with Apache License 2.0 | 5 votes |
@Override public Param build(Method javaMethod, int paramIndex, Annotation paramAnnotation) { final RequestParam requestParam = (RequestParam) paramAnnotation; final Param param = new Param() .withName(discoverParamName(javaMethod, paramIndex, requestParam.value())) .withStyle(ParamStyle.QUERY) .withRequired(requestParam.required()) .withType(grammarsDiscoverer.discoverQNameFor(new ClassMetadataFromParam(javaMethod, paramIndex))); if (!ValueConstants.DEFAULT_NONE.equals(requestParam.defaultValue())) { param.setDefault(requestParam.defaultValue()); } return param; }
Example #14
Source File: AbstractNamedValueMethodArgumentResolver.java From java-technology-stack with MIT License | 5 votes |
/** * Create a new NamedValueInfo based on the given NamedValueInfo with sanitized values. */ private NamedValueInfo updateNamedValueInfo(MethodParameter parameter, NamedValueInfo info) { String name = info.name; if (info.name.isEmpty()) { name = parameter.getParameterName(); if (name == null) { throw new IllegalArgumentException( "Name for argument type [" + parameter.getNestedParameterType().getName() + "] not available, and parameter name information not found in class file either."); } } String defaultValue = (ValueConstants.DEFAULT_NONE.equals(info.defaultValue) ? null : info.defaultValue); return new NamedValueInfo(name, info.required, defaultValue); }
Example #15
Source File: RequestParamMethodArgumentResolver.java From java-technology-stack with MIT License | 5 votes |
@Override public void contributeMethodArgument(MethodParameter parameter, @Nullable Object value, UriComponentsBuilder builder, Map<String, Object> uriVariables, ConversionService conversionService) { Class<?> paramType = parameter.getNestedParameterType(); if (Map.class.isAssignableFrom(paramType) || MultipartFile.class == paramType || Part.class == paramType) { return; } RequestParam requestParam = parameter.getParameterAnnotation(RequestParam.class); String name = (requestParam == null || StringUtils.isEmpty(requestParam.name()) ? parameter.getParameterName() : requestParam.name()); Assert.state(name != null, "Unresolvable parameter name"); if (value == null) { if (requestParam != null && (!requestParam.required() || !requestParam.defaultValue().equals(ValueConstants.DEFAULT_NONE))) { return; } builder.queryParam(name); } else if (value instanceof Collection) { for (Object element : (Collection<?>) value) { element = formatUriValue(conversionService, TypeDescriptor.nested(parameter, 1), element); builder.queryParam(name, element); } } else { builder.queryParam(name, formatUriValue(conversionService, new TypeDescriptor(parameter), value)); } }
Example #16
Source File: PropertyJobParam.java From choerodon-starters with Apache License 2.0 | 5 votes |
PropertyJobParam(final JobParam jobParam) { this.name = jobParam.name(); this.type = getParamTypeByClass(jobParam.type()).getValue(); if (!ValueConstants.DEFAULT_NONE.equals(jobParam.defaultValue())) { try { this.defaultValue = jobParam.type().getConstructor(String.class).newInstance(jobParam.defaultValue()); } catch (InstantiationException | IllegalAccessException | InvocationTargetException | NoSuchMethodException e) { throw new JobParamDefaultValueParseException(e, jobParam.type(), jobParam.defaultValue()); } } this.description = jobParam.description(); }
Example #17
Source File: AbstractSpringmvcSerializableParameterProcessor.java From servicecomb-java-chassis with Apache License 2.0 | 5 votes |
@Override protected String readDefaultValue(ANNOTATION annotation) { String defaultValue = pureReadDefaultValue(annotation); if (StringUtils.isEmpty(defaultValue) || defaultValue.equals(ValueConstants.DEFAULT_NONE)) { return ""; } return defaultValue; }
Example #18
Source File: MatrixVariableMapMethodArgumentResolver.java From lams with GNU General Public License v2.0 | 5 votes |
@Override public Object resolveArgument(MethodParameter parameter, ModelAndViewContainer mavContainer, NativeWebRequest request, WebDataBinderFactory binderFactory) throws Exception { @SuppressWarnings("unchecked") Map<String, MultiValueMap<String, String>> matrixVariables = (Map<String, MultiValueMap<String, String>>) request.getAttribute( HandlerMapping.MATRIX_VARIABLES_ATTRIBUTE, RequestAttributes.SCOPE_REQUEST); if (CollectionUtils.isEmpty(matrixVariables)) { return Collections.emptyMap(); } MultiValueMap<String, String> map = new LinkedMultiValueMap<String, String>(); String pathVariable = parameter.getParameterAnnotation(MatrixVariable.class).pathVar(); if (!pathVariable.equals(ValueConstants.DEFAULT_NONE)) { MultiValueMap<String, String> mapForPathVariable = matrixVariables.get(pathVariable); if (mapForPathVariable == null) { return Collections.emptyMap(); } map.putAll(mapForPathVariable); } else { for (MultiValueMap<String, String> vars : matrixVariables.values()) { for (String name : vars.keySet()) { for (String value : vars.get(name)) { map.add(name, value); } } } } return (isSingleValueMap(parameter) ? map.toSingleValueMap() : map); }
Example #19
Source File: AbstractNamedValueMethodArgumentResolver.java From lams with GNU General Public License v2.0 | 5 votes |
/** * Create a new NamedValueInfo based on the given NamedValueInfo with sanitized values. */ private NamedValueInfo updateNamedValueInfo(MethodParameter parameter, NamedValueInfo info) { String name = info.name; if (info.name.isEmpty()) { name = parameter.getParameterName(); if (name == null) { throw new IllegalArgumentException( "Name for argument type [" + parameter.getNestedParameterType().getName() + "] not available, and parameter name information not found in class file either."); } } String defaultValue = (ValueConstants.DEFAULT_NONE.equals(info.defaultValue) ? null : info.defaultValue); return new NamedValueInfo(name, info.required, defaultValue); }
Example #20
Source File: RequestParamMethodArgumentResolver.java From lams with GNU General Public License v2.0 | 5 votes |
@Override public void contributeMethodArgument(MethodParameter parameter, Object value, UriComponentsBuilder builder, Map<String, Object> uriVariables, ConversionService conversionService) { Class<?> paramType = parameter.getNestedParameterType(); if (Map.class.isAssignableFrom(paramType) || MultipartFile.class == paramType || "javax.servlet.http.Part".equals(paramType.getName())) { return; } RequestParam requestParam = parameter.getParameterAnnotation(RequestParam.class); String name = (requestParam == null || StringUtils.isEmpty(requestParam.name()) ? parameter.getParameterName() : requestParam.name()); if (value == null) { if (requestParam != null) { if (!requestParam.required() || !requestParam.defaultValue().equals(ValueConstants.DEFAULT_NONE)) { return; } } builder.queryParam(name); } else if (value instanceof Collection) { for (Object element : (Collection<?>) value) { element = formatUriValue(conversionService, TypeDescriptor.nested(parameter, 1), element); builder.queryParam(name, element); } } else { builder.queryParam(name, formatUriValue(conversionService, new TypeDescriptor(parameter), value)); } }
Example #21
Source File: WxApiMethodInfo.java From FastBootWeixin with Apache License 2.0 | 5 votes |
private String getMethodWxApiRequestPath(Method method) { WxApiRequest wxApiRequest = AnnotatedElementUtils.findMergedAnnotation(method, WxApiRequest.class); if (wxApiRequest == null || StringUtils.isEmpty(wxApiRequest.path()) || ValueConstants.DEFAULT_NONE.equals(wxApiRequest.path())) { // 默认情况下取方法名为变量名,尝试从环境变量中获取信息 return WxContextUtils.resolveStringValue("${" + this.wxApiTypeInfo.getPropertyPrefix() + "." + method.getName() + "}"); } return wxApiRequest.path(); }
Example #22
Source File: WxApiExecutor.java From FastBootWeixin with Apache License 2.0 | 5 votes |
/** * 要发送文件,使用这种方式,请查看源码:FormHttpMessageConverter * * @param wxApiMethodInfo * @param args * @return the result */ private Object getFormBody(WxApiMethodInfo wxApiMethodInfo, Object[] args) { MultiValueMap<String, Object> params = new LinkedMultiValueMap<>(); wxApiMethodInfo.getMethodParameters().stream() .filter(p -> !BeanUtils.isSimpleValueType(p.getParameterType()) || p.hasParameterAnnotation(WxApiForm.class) || p.hasParameterAnnotation(WxApiBody.class)) .forEach(p -> { // 为空则直接返回不加这个参数 if (args[p.getParameterIndex()] == null) { return; } WxApiForm wxApiForm = p.getParameterAnnotation(WxApiForm.class); String paramName; Object param; if (wxApiForm == null || ValueConstants.DEFAULT_NONE.equals(wxApiForm.value())) { paramName = p.getParameterName(); } else { paramName = wxApiForm.value(); } // 加入Assert WxAppAssert.notNull(paramName, "请添加编译器的-parameter或者为参数添加注解名称"); if (WxWebUtils.isMutlipart(p.getParameterType())) { param = getFormResource(args[p.getParameterIndex()]); } else { param = args[p.getParameterIndex()]; } params.add(paramName, param); }); return params; }
Example #23
Source File: AbstractNamedValueMethodArgumentResolver.java From spring4-understanding with Apache License 2.0 | 5 votes |
/** * Create a new NamedValueInfo based on the given NamedValueInfo with sanitized values. */ private NamedValueInfo updateNamedValueInfo(MethodParameter parameter, NamedValueInfo info) { String name = info.name; if (info.name.length() == 0) { name = parameter.getParameterName(); if (name == null) { throw new IllegalArgumentException("Name for argument type [" + parameter.getParameterType().getName() + "] not available, and parameter name information not found in class file either."); } } String defaultValue = (ValueConstants.DEFAULT_NONE.equals(info.defaultValue) ? null : info.defaultValue); return new NamedValueInfo(name, info.required, defaultValue); }
Example #24
Source File: MockHttpServletRequestBuilder.java From spring4-understanding with Apache License 2.0 | 5 votes |
/** * Update the contextPath, servletPath, and pathInfo of the request. */ private void updatePathRequestProperties(MockHttpServletRequest request, String requestUri) { Assert.isTrue(requestUri.startsWith(this.contextPath), "requestURI [" + requestUri + "] does not start with contextPath [" + this.contextPath + "]"); request.setContextPath(this.contextPath); request.setServletPath(this.servletPath); if (ValueConstants.DEFAULT_NONE.equals(this.pathInfo)) { Assert.isTrue(requestUri.startsWith(this.contextPath + this.servletPath), "Invalid servletPath [" + this.servletPath + "] for requestURI [" + requestUri + "]"); String extraPath = requestUri.substring(this.contextPath.length() + this.servletPath.length()); this.pathInfo = (StringUtils.hasText(extraPath)) ? extraPath : null; } request.setPathInfo(this.pathInfo); }
Example #25
Source File: MatrixVariableMethodArgumentResolver.java From spring-analysis-note with MIT License | 4 votes |
@Nullable @Override protected Object resolveNamedValue(String name, MethodParameter param, ServerWebExchange exchange) { Map<String, MultiValueMap<String, String>> pathParameters = exchange.getAttribute(HandlerMapping.MATRIX_VARIABLES_ATTRIBUTE); if (CollectionUtils.isEmpty(pathParameters)) { return null; } MatrixVariable ann = param.getParameterAnnotation(MatrixVariable.class); Assert.state(ann != null, "No MatrixVariable annotation"); String pathVar = ann.pathVar(); List<String> paramValues = null; if (!pathVar.equals(ValueConstants.DEFAULT_NONE)) { if (pathParameters.containsKey(pathVar)) { paramValues = pathParameters.get(pathVar).get(name); } } else { boolean found = false; paramValues = new ArrayList<>(); for (MultiValueMap<String, String> params : pathParameters.values()) { if (params.containsKey(name)) { if (found) { String paramType = param.getNestedParameterType().getName(); throw new ServerErrorException( "Found more than one match for URI path parameter '" + name + "' for parameter type [" + paramType + "]. Use 'pathVar' attribute to disambiguate.", param, null); } paramValues.addAll(params.get(name)); found = true; } } } if (CollectionUtils.isEmpty(paramValues)) { return null; } else if (paramValues.size() == 1) { return paramValues.get(0); } else { return paramValues; } }
Example #26
Source File: RequestAttributeMethodArgumentResolver.java From spring-analysis-note with MIT License | 4 votes |
@Override protected NamedValueInfo createNamedValueInfo(MethodParameter parameter) { RequestAttribute ann = parameter.getParameterAnnotation(RequestAttribute.class); Assert.state(ann != null, "No RequestAttribute annotation"); return new NamedValueInfo(ann.name(), ann.required(), ValueConstants.DEFAULT_NONE); }
Example #27
Source File: WxApiTypeInfo.java From FastBootWeixin with Apache License 2.0 | 4 votes |
private String getTypeWxApiRequestPath(WxApiRequest wxApiRequest) { if (wxApiRequest == null || StringUtils.isEmpty(wxApiRequest.path()) || ValueConstants.DEFAULT_NONE.equals(wxApiRequest.path())) { return "/"; } return wxApiRequest.path(); }
Example #28
Source File: WxApiTypeInfo.java From FastBootWeixin with Apache License 2.0 | 4 votes |
private String getTypeWxApiPropertyPrefix(WxApiRequest wxApiRequest) { if (wxApiRequest == null || StringUtils.isEmpty(wxApiRequest.prefix()) || ValueConstants.DEFAULT_NONE.equals(wxApiRequest.prefix())) { return WX_API_PROPERTY_PREFIX; } return wxApiRequest.prefix(); }
Example #29
Source File: WxApiTypeInfo.java From FastBootWeixin with Apache License 2.0 | 4 votes |
private String getTypeWxApiHost(WxApiRequest wxApiRequest, String defaultHost) { if (wxApiRequest == null || StringUtils.isEmpty(wxApiRequest.host()) || ValueConstants.DEFAULT_NONE.equals(wxApiRequest.host())) { return defaultHost; } return wxApiRequest.host(); }
Example #30
Source File: HandlerMethodInvoker.java From lams with GNU General Public License v2.0 | 4 votes |
protected String parseDefaultValueAttribute(String value) { return (ValueConstants.DEFAULT_NONE.equals(value) ? null : value); }