Java Code Examples for org.springframework.core.MethodParameter#hasParameterAnnotation()
The following examples show how to use
org.springframework.core.MethodParameter#hasParameterAnnotation() .
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: RequestBodyArgumentResolver.java From mPass with Apache License 2.0 | 6 votes |
@SuppressWarnings("unchecked") @Override public boolean supportsParameter(MethodParameter parameter) { boolean supported = parameter.hasParameterAnnotation(RequestBody.class); if (!supported) { Method curMethod = (Method) parameter.getExecutable(); Class<?> curClass = curMethod.getDeclaringClass(); List<Class<?>> supperList =new ArrayList<>(Arrays.asList(curClass.getInterfaces())); Class superclass=curClass.getSuperclass(); if(superclass!=null && !Object.class.equals(superclass) ){ supperList.add(superclass); } for (Class<?> clazz : supperList) { if (hasRequestBodyAnnotation(clazz, parameter)) { supported = true; break; } } } return supported; }
Example 2
Source File: OpenFeignAutoConfiguration.java From summerframework with Apache License 2.0 | 6 votes |
public static MethodParameter interfaceMethodParameter(MethodParameter parameter, Class annotationType) { if (!parameter.hasParameterAnnotation(annotationType)) { for (Class<?> itf : parameter.getDeclaringClass().getInterfaces()) { try { Method method = itf.getMethod(parameter.getMethod().getName(), parameter.getMethod().getParameterTypes()); MethodParameter itfParameter = new InterfaceMethodParameter(method, parameter.getParameterIndex()); if (itfParameter.hasParameterAnnotation(annotationType)) { return itfParameter; } } catch (NoSuchMethodException e) { continue; } } } return parameter; }
Example 3
Source File: MatrixVariableMethodArgumentResolver.java From java-technology-stack with MIT License | 5 votes |
@Override public boolean supportsParameter(MethodParameter parameter) { if (!parameter.hasParameterAnnotation(MatrixVariable.class)) { return false; } if (Map.class.isAssignableFrom(parameter.nestedIfOptional().getNestedParameterType())) { MatrixVariable matrixVariable = parameter.getParameterAnnotation(MatrixVariable.class); return (matrixVariable != null && StringUtils.hasText(matrixVariable.name())); } return true; }
Example 4
Source File: MatrixVariableMethodArgumentResolver.java From spring-analysis-note with MIT License | 5 votes |
@Override public boolean supportsParameter(MethodParameter parameter) { if (!parameter.hasParameterAnnotation(MatrixVariable.class)) { return false; } if (Map.class.isAssignableFrom(parameter.nestedIfOptional().getNestedParameterType())) { MatrixVariable matrixVariable = parameter.getParameterAnnotation(MatrixVariable.class); return (matrixVariable != null && StringUtils.hasText(matrixVariable.name())); } return true; }
Example 5
Source File: ModelFactory.java From lams with GNU General Public License v2.0 | 5 votes |
public ModelMethod(InvocableHandlerMethod handlerMethod) { this.handlerMethod = handlerMethod; for (MethodParameter parameter : handlerMethod.getMethodParameters()) { if (parameter.hasParameterAnnotation(ModelAttribute.class)) { this.dependencies.add(getNameForParameter(parameter)); } } }
Example 6
Source File: SmartPayloadArgumentResolver.java From spring-cloud-stream with Apache License 2.0 | 5 votes |
@Override public boolean supportsParameter(MethodParameter parameter) { return (!Message.class.isAssignableFrom(parameter.getParameterType()) && !MessageHeaders.class.isAssignableFrom(parameter.getParameterType()) && !parameter.hasParameterAnnotation(Header.class) && !parameter.hasParameterAnnotation(Headers.class)); }
Example 7
Source File: ModelFactory.java From spring-analysis-note with MIT License | 5 votes |
public ModelMethod(InvocableHandlerMethod handlerMethod) { this.handlerMethod = handlerMethod; for (MethodParameter parameter : handlerMethod.getMethodParameters()) { if (parameter.hasParameterAnnotation(ModelAttribute.class)) { this.dependencies.add(getNameForParameter(parameter)); } } }
Example 8
Source File: RequestPartMethodArgumentResolver.java From lams with GNU General Public License v2.0 | 5 votes |
/** * Supports the following: * <ul> * <li>annotated with {@code @RequestPart} * <li>of type {@link MultipartFile} unless annotated with {@code @RequestParam} * <li>of type {@code javax.servlet.http.Part} unless annotated with {@code @RequestParam} * </ul> */ @Override public boolean supportsParameter(MethodParameter parameter) { if (parameter.hasParameterAnnotation(RequestPart.class)) { return true; } else { if (parameter.hasParameterAnnotation(RequestParam.class)) { return false; } return MultipartResolutionDelegate.isMultipartArgument(parameter.nestedIfOptional()); } }
Example 9
Source File: RequestParamMethodArgumentResolver.java From netty-websocket-spring-boot-starter with Apache License 2.0 | 4 votes |
@Override public boolean supportsParameter(MethodParameter parameter) { return parameter.hasParameterAnnotation(RequestParam.class); }
Example 10
Source File: RequestResponseBodyMethodProcessor.java From spring-analysis-note with MIT License | 4 votes |
@Override public boolean supportsParameter(MethodParameter parameter) { return parameter.hasParameterAnnotation(RequestBody.class); }
Example 11
Source File: JwtTokenArgumentResolver.java From watchdog-framework with MIT License | 4 votes |
@Override public boolean supportsParameter(MethodParameter parameter) { return parameter.hasParameterAnnotation(JwtClaim.class); }
Example 12
Source File: RequestPartMethodArgumentResolver.java From spring-analysis-note with MIT License | 4 votes |
@Override public boolean supportsParameter(MethodParameter parameter) { return (parameter.hasParameterAnnotation(RequestPart.class) || checkParameterType(parameter, Part.class::isAssignableFrom)); }
Example 13
Source File: LoginUserHandlerMethodArgumentResolver.java From mall with MIT License | 4 votes |
@Override public boolean supportsParameter(MethodParameter parameter) { return parameter.getParameterType().isAssignableFrom(Integer.class) && parameter.hasParameterAnnotation(LoginUser.class); }
Example 14
Source File: RequestHeaderMethodArgumentResolver.java From spring4-understanding with Apache License 2.0 | 4 votes |
@Override public boolean supportsParameter(MethodParameter parameter) { return (parameter.hasParameterAnnotation(RequestHeader.class) && !Map.class.isAssignableFrom(parameter.getParameterType())); }
Example 15
Source File: CometParamResolver.java From Milkomeda with MIT License | 4 votes |
@Override public boolean supportsParameter(MethodParameter methodParameter) { return methodParameter.hasParameterAnnotation(CometParam.class); }
Example 16
Source File: LoginUserHandlerMethodArgumentResolver.java From litemall with MIT License | 4 votes |
@Override public boolean supportsParameter(MethodParameter parameter) { return parameter.getParameterType().isAssignableFrom(Integer.class) && parameter.hasParameterAnnotation(LoginUser.class); }
Example 17
Source File: PathVariableMethodArgumentResolver.java From netty-websocket-spring-boot-starter with Apache License 2.0 | 4 votes |
@Override public boolean supportsParameter(MethodParameter parameter) { return parameter.hasParameterAnnotation(PathVariable.class); }
Example 18
Source File: SessionAttributeMethodArgumentResolver.java From java-technology-stack with MIT License | 4 votes |
@Override public boolean supportsParameter(MethodParameter parameter) { return parameter.hasParameterAnnotation(SessionAttribute.class); }
Example 19
Source File: AbstractCookieValueMethodArgumentResolver.java From java-technology-stack with MIT License | 4 votes |
@Override public boolean supportsParameter(MethodParameter parameter) { return parameter.hasParameterAnnotation(CookieValue.class); }
Example 20
Source File: WebAttributeArgumentResolver.java From onetwo with Apache License 2.0 | 4 votes |
@Override public boolean supportsParameter(MethodParameter parameter) { return parameter.hasParameterAnnotation(WebAttribute.class); }