Here are the examples of the java api org.springframework.core.MethodParameter taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
2398 Examples
19
Source : ContextArgumentResolver.java
with Apache License 2.0
from zuihou
with Apache License 2.0
from zuihou
/**
* 入参筛选
*
* @param mp 参数集合
* @return 格式化后的参数
*/
@Override
public boolean supportsParameter(MethodParameter mp) {
return mp.hasParameterAnnotation(LoginUser.clreplaced) && mp.getParameterType().equals(SysUser.clreplaced);
}
19
Source : AbstractGlobalResponseBodyAdvice.java
with Apache License 2.0
from zuihou
with Apache License 2.0
from zuihou
@Override
public Object beforeBodyWrite(Object o, MethodParameter methodParameter, MediaType mediaType, Clreplaced aClreplaced, ServerHttpRequest serverHttpRequest, ServerHttpResponse serverHttpResponse) {
if (o == null) {
return null;
}
if (o instanceof R) {
return o;
}
return R.success(o);
}
19
Source : TokenArgumentResolver.java
with Apache License 2.0
from zlt2000
with Apache License 2.0
from zlt2000
/**
* 入参筛选
*
* @param methodParameter 参数集合
* @return 格式化后的参数
*/
@Override
public boolean supportsParameter(MethodParameter methodParameter) {
return methodParameter.hasParameterAnnotation(LoginUser.clreplaced) && methodParameter.getParameterType().equals(SysUser.clreplaced);
}
19
Source : ClientArgumentResolver.java
with Apache License 2.0
from zlt2000
with Apache License 2.0
from zlt2000
/**
* 入参筛选
*
* @param methodParameter 参数集合
* @return 格式化后的参数
*/
@Override
public boolean supportsParameter(MethodParameter methodParameter) {
return methodParameter.hasParameterAnnotation(LoginClient.clreplaced) && methodParameter.getParameterType().equals(String.clreplaced);
}
19
Source : GlobalResultHandler.java
with MIT License
from zidoshare
with MIT License
from zidoshare
@Override
public boolean supports(MethodParameter returnType, Clreplaced<? extends HttpMessageConverter<?>> converterType) {
// 支持Optional包装
return !factory.isExceptedClreplaced(returnType.nestedIfOptional().getParameterType());
}
19
Source : SortArgumentResolver.java
with Apache License 2.0
from zhouxx
with Apache License 2.0
from zhouxx
@Override
public boolean supportsParameter(MethodParameter parameter) {
return Sort.clreplaced.equals(parameter.getParameterType());
}
19
Source : PageableArgumentResolver.java
with Apache License 2.0
from zhouxx
with Apache License 2.0
from zhouxx
@Override
public boolean supportsParameter(MethodParameter parameter) {
return Pageable.clreplaced.equals(parameter.getParameterType()) || Page.clreplaced.equals(parameter.getParameterType());
}
19
Source : ResultWarpReturnValueHandler.java
with GNU Affero General Public License v3.0
from zhouhuan751312
with GNU Affero General Public License v3.0
from zhouhuan751312
/**
* 判断返回类型是否需要转成字符串返回
* @param returnType 方法返回类型
* @return 需要转换返回true,否则返回false
*/
@Override
public boolean supportsReturnType(MethodParameter returnType) {
return delegate.supportsReturnType(returnType);
}
19
Source : TokenToUserMethodArgumentResolver.java
with Apache License 2.0
from ZHENFENG13
with Apache License 2.0
from ZHENFENG13
public boolean supportsParameter(MethodParameter parameter) {
if (parameter.hasParameterAnnotation(TokenToUser.clreplaced)) {
return true;
}
return false;
}
19
Source : LoginUserHandlerMethodArgumentResolver.java
with GNU General Public License v3.0
from zhaoqicheng
with GNU General Public License v3.0
from zhaoqicheng
@Override
public boolean supportsParameter(MethodParameter parameter) {
return parameter.getParameterType().isreplacedignableFrom(UserEnreplacedy.clreplaced) && parameter.hasParameterAnnotation(LoginUser.clreplaced);
}
19
Source : LoginUserHandlerMethodArgumentResolver.java
with GNU General Public License v3.0
from zcbin
with GNU General Public License v3.0
from zcbin
@Override
public boolean supportsParameter(MethodParameter parameter) {
return parameter.getParameterType().isreplacedignableFrom(Integer.clreplaced) && parameter.hasParameterAnnotation(LoginUser.clreplaced);
}
19
Source : ControllerAdviceHandler.java
with Apache License 2.0
from yz-java
with Apache License 2.0
from yz-java
@Override
public boolean supports(MethodParameter returnType, Clreplaced converterType) {
return true;
}
19
Source : ByteDanceOpenDemoResponseAdvice.java
with MIT License
from yydzxz
with MIT License
from yydzxz
@Override
public boolean supports(MethodParameter methodParameter, Clreplaced<? extends HttpMessageConverter<?>> converterType) {
return true;
}
19
Source : ByteDanceOpenDemoResponseAdvice.java
with MIT License
from yydzxz
with MIT License
from yydzxz
@Override
public Object beforeBodyWrite(Object body, MethodParameter methodParameter, MediaType mediaType, Clreplaced<? extends HttpMessageConverter<?>> selectedConverterType, ServerHttpRequest serverHttpRequest, ServerHttpResponse serverHttpResponse) {
if (body instanceof ByteDanceOpenDemoResponse) {
return body;
} else if (body instanceof String) {
return body;
} else if (body instanceof byte[]) {
return body;
}
ByteDanceOpenDemoResponse response = new ByteDanceOpenDemoResponse();
response.setCode(0);
response.setData(body);
response.setMsg("success");
return response;
}
19
Source : GlobalResponseBodyHandler.java
with MIT License
from YunaiV
with MIT License
from YunaiV
@Override
// 避免 IDEA 警告
@SuppressWarnings("NullableProblems")
public boolean supports(MethodParameter returnType, Clreplaced converterType) {
if (returnType.getMethod() == null) {
return false;
}
// 只拦截返回结果为 CommonResult 类型
return returnType.getMethod().getReturnType() == CommonResult.clreplaced;
}
19
Source : PageableMethodArgumentResolver.java
with MIT License
from ymm-tech
with MIT License
from ymm-tech
@Override
public boolean supportsParameter(MethodParameter parameter) {
return parameter.getParameterType() == Pageable.clreplaced;
}
19
Source : ResultResponseBodyHandler.java
with Apache License 2.0
from yl-yue
with Apache License 2.0
from yl-yue
@Override
public boolean supports(MethodParameter returnType, Clreplaced<? extends HttpMessageConverter<?>> converterType) {
if (returnType.getMethod().getReturnType() != Result.clreplaced) {
return false;
}
return true;
}
19
Source : JSONObjectArgumentResolver.java
with Apache License 2.0
from yl-yue
with Apache License 2.0
from yl-yue
@Override
public boolean supportsParameter(MethodParameter parameter) {
return parameter.getParameterType().equals(JSONObject.clreplaced);
}
19
Source : LoginUserHandlerMethodArgumentResolver.java
with Apache License 2.0
from yjjdick
with Apache License 2.0
from yjjdick
@Override
public boolean supportsParameter(MethodParameter parameter) {
return parameter.getParameterType().isreplacedignableFrom(User.clreplaced) && parameter.hasParameterAnnotation(LoginUser.clreplaced);
}
19
Source : CometResponseBodyAdvice.java
with MIT License
from yizzuide
with MIT License
from yizzuide
@Override
public boolean supports(@NonNull MethodParameter returnType, @NonNull Clreplaced<? extends HttpMessageConverter<?>> converterType) {
return true;
}
19
Source : CometResponseBodyAdvice.java
with MIT License
from yizzuide
with MIT License
from yizzuide
@Override
public Object beforeBodyWrite(Object body, @NonNull MethodParameter returnType, @NonNull MediaType selectedContentType, @NonNull Clreplaced<? extends HttpMessageConverter<?>> selectedConverterType, @NonNull ServerHttpRequest request, @NonNull ServerHttpResponse response) {
RequestAttributes requestAttributes = RequestContextHolder.getRequestAttributes();
if (requestAttributes instanceof ServletRequestAttributes) {
((ServletRequestAttributes) requestAttributes).getRequest().setAttribute(REQUEST_ATTRIBUTE_BODY, body);
}
return body;
}
19
Source : CometParamResolver.java
with MIT License
from yizzuide
with MIT License
from yizzuide
@Override
public boolean supportsParameter(MethodParameter methodParameter) {
return methodParameter.hasParameterAnnotation(CometParam.clreplaced);
}
19
Source : DefaultHandlerMethodReturnValueHandler.java
with Apache License 2.0
from yin5980280
with Apache License 2.0
from yin5980280
/**
* 判断是否标注ignored
* @param returnType
* @return
*/
private boolean ignored(MethodParameter returnType) {
boolean typeIgnored = returnType.getMethod() != null && returnType.getMethod().getDeclaringClreplaced().isAnnotationPresent(Ignored.clreplaced);
return typeIgnored || returnType.getMethodAnnotation(Ignored.clreplaced) != null;
}
19
Source : ThrowableMethodArgumentResolver.java
with Apache License 2.0
from YeautyYE
with Apache License 2.0
from YeautyYE
@Override
public boolean supportsParameter(MethodParameter parameter) {
return parameter.getMethod().isAnnotationPresent(OnError.clreplaced) && Throwable.clreplaced.isreplacedignableFrom(parameter.getParameterType());
}
19
Source : TextMethodArgumentResolver.java
with Apache License 2.0
from YeautyYE
with Apache License 2.0
from YeautyYE
@Override
public boolean supportsParameter(MethodParameter parameter) {
return parameter.getMethod().isAnnotationPresent(OnMessage.clreplaced) && String.clreplaced.isreplacedignableFrom(parameter.getParameterType());
}
19
Source : SessionMethodArgumentResolver.java
with Apache License 2.0
from YeautyYE
with Apache License 2.0
from YeautyYE
@Override
public boolean supportsParameter(MethodParameter parameter) {
return Session.clreplaced.isreplacedignableFrom(parameter.getParameterType());
}
19
Source : RequestParamMethodArgumentResolver.java
with Apache License 2.0
from YeautyYE
with Apache License 2.0
from YeautyYE
@Override
public boolean supportsParameter(MethodParameter parameter) {
return parameter.hasParameterAnnotation(RequestParam.clreplaced);
}
19
Source : PathVariableMethodArgumentResolver.java
with Apache License 2.0
from YeautyYE
with Apache License 2.0
from YeautyYE
@Override
public boolean supportsParameter(MethodParameter parameter) {
return parameter.hasParameterAnnotation(PathVariable.clreplaced);
}
19
Source : HttpHeadersMethodArgumentResolver.java
with Apache License 2.0
from YeautyYE
with Apache License 2.0
from YeautyYE
@Override
public boolean supportsParameter(MethodParameter parameter) {
return HttpHeaders.clreplaced.isreplacedignableFrom(parameter.getParameterType());
}
19
Source : ByteMethodArgumentResolver.java
with Apache License 2.0
from YeautyYE
with Apache License 2.0
from YeautyYE
@Override
public boolean supportsParameter(MethodParameter parameter) {
return parameter.getMethod().isAnnotationPresent(OnBinary.clreplaced) && byte[].clreplaced.isreplacedignableFrom(parameter.getParameterType());
}
19
Source : CurrentAccountMethodArgumentResolver.java
with Apache License 2.0
from xuexiangjys
with Apache License 2.0
from xuexiangjys
@Override
public boolean supportsParameter(MethodParameter parameter) {
return // 判断是否能转成Account类型
parameter.getParameterType().isreplacedignableFrom(Account.clreplaced) && // 是否有CurrentAccount注解
parameter.hasParameterAnnotation(CurrentAccount.clreplaced);
}
19
Source : AppControllerAdvice.java
with Apache License 2.0
from Xlinlin
with Apache License 2.0
from Xlinlin
@Override
public boolean supports(MethodParameter methodParameter, Clreplaced aClreplaced) {
return true;
}
19
Source : SecureUserArgumentResolver.java
with GNU Lesser General Public License v3.0
from xkcoding
with GNU Lesser General Public License v3.0
from xkcoding
/**
* 参数上必须包含 {@link CurrentUser} 注解,同时满足参数类型是 {@link SecureUser}
*
* @param parameter 参数
* @return 满足条件 true,反之 false
*/
@Override
public boolean supportsParameter(MethodParameter parameter) {
return parameter.getParameterType().isreplacedignableFrom(SecureUser.clreplaced) && parameter.hasParameterAnnotation(CurrentUser.clreplaced);
}
19
Source : GlobalResponseHandler.java
with Apache License 2.0
from Xiao-Y
with Apache License 2.0
from Xiao-Y
@Override
public boolean supports(MethodParameter returnType, Clreplaced<? extends HttpMessageConverter<?>> converterType) {
// 判断支持的类型,因为我们定义的BaseResponseVo 里面的data可能是任何类型,这里就不判断统一放过
// 如果你想对执行的返回体进行操作,可将上方的Object换成你自己的类型
return true;
}
19
Source : RangeMethodArgumentResolver.java
with Apache License 2.0
from xiangxik
with Apache License 2.0
from xiangxik
@Override
public boolean supportsParameter(MethodParameter parameter) {
return parameter.hasParameterAnnotation(RangeParam.clreplaced);
}
19
Source : FilterPredicateArgumentResolver.java
with Apache License 2.0
from xiangxik
with Apache License 2.0
from xiangxik
@Override
public boolean supportsParameter(MethodParameter parameter) {
if (Predicate.clreplaced.equals(parameter.getParameterType())) {
return true;
}
if (parameter.hasParameterAnnotation(QuerydslPredicate.clreplaced)) {
throw new IllegalArgumentException(String.format("Parameter at position %s must be of type Predicate but was %s.", parameter.getParameterIndex(), parameter.getParameterType()));
}
return false;
}
19
Source : LoginUserArgumentResolver.java
with MIT License
from woowacourse-teams
with MIT License
from woowacourse-teams
@Override
public boolean supportsParameter(MethodParameter parameter) {
return parameter.hasParameterAnnotation(LoginUser.clreplaced);
}
19
Source : LoginMemberArgumentResolver.java
with MIT License
from woowacourse-teams
with MIT License
from woowacourse-teams
@Override
public boolean supportsParameter(final MethodParameter parameter) {
return parameter.hasParameterAnnotation(LoginMember.clreplaced);
}
19
Source : WeCubeResponseResultProcess.java
with Apache License 2.0
from WeBankPartners
with Apache License 2.0
from WeBankPartners
@Override
public Object beforeBodyWrite(Object body, MethodParameter returnType, MediaType selectedContentType, Clreplaced<? extends HttpMessageConverter<?>> selectedConverterType, ServerHttpRequest request, ServerHttpResponse response) {
return body;
}
19
Source : WeCubeResponseResultProcess.java
with Apache License 2.0
from WeBankPartners
with Apache License 2.0
from WeBankPartners
@Override
public boolean supports(MethodParameter returnType, Clreplaced<? extends HttpMessageConverter<?>> converterType) {
return true;
}
19
Source : JwtTokenArgumentResolver.java
with MIT License
from watchdog-framework
with MIT License
from watchdog-framework
@Override
public boolean supportsParameter(MethodParameter parameter) {
return parameter.hasParameterAnnotation(JwtClaim.clreplaced);
}
19
Source : MessageBrokerBeanDefinitionParserTests.java
with MIT License
from Vip-Augus
with MIT License
from Vip-Augus
@Override
public void handleReturnValue(Object returnValue, MethodParameter returnType, Message<?> message) throws Exception {
}
19
Source : MessageBrokerBeanDefinitionParserTests.java
with MIT License
from Vip-Augus
with MIT License
from Vip-Augus
@Override
public boolean supportsReturnType(MethodParameter returnType) {
return false;
}
19
Source : MessageBrokerBeanDefinitionParserTests.java
with MIT License
from Vip-Augus
with MIT License
from Vip-Augus
@Override
public boolean supportsParameter(MethodParameter parameter) {
return false;
}
19
Source : MessageBrokerBeanDefinitionParserTests.java
with MIT License
from Vip-Augus
with MIT License
from Vip-Augus
@Override
public Object resolveArgument(MethodParameter parameter, Message<?> message) throws Exception {
return null;
}
19
Source : ServletResponseMethodArgumentResolverTests.java
with MIT License
from Vip-Augus
with MIT License
from Vip-Augus
// SPR-8983
@Test
public void servletResponseNoMavContainer() throws Exception {
MethodParameter servletResponseParameter = new MethodParameter(method, 0);
replacedertTrue("ServletResponse not supported", resolver.supportsParameter(servletResponseParameter));
Object result = resolver.resolveArgument(servletResponseParameter, null, webRequest, null);
replacedertSame("Invalid result", servletResponse, result);
}
19
Source : ServletRequestMethodArgumentResolverTests.java
with MIT License
from Vip-Augus
with MIT License
from Vip-Augus
@Test
public void httpMethod() throws Exception {
MethodParameter httpMethodParameter = new MethodParameter(method, 10);
replacedertTrue("HttpMethod not supported", resolver.supportsParameter(httpMethodParameter));
Object result = resolver.resolveArgument(httpMethodParameter, null, webRequest, null);
replacedertSame("Invalid result", HttpMethod.valueOf(webRequest.getRequest().getMethod()), result);
}
19
Source : ServletRequestMethodArgumentResolverTests.java
with MIT License
from Vip-Augus
with MIT License
from Vip-Augus
@Test
public void inputStream() throws Exception {
MethodParameter inputStreamParameter = new MethodParameter(method, 5);
replacedertTrue("InputStream not supported", resolver.supportsParameter(inputStreamParameter));
Object result = resolver.resolveArgument(inputStreamParameter, null, webRequest, null);
replacedertSame("Invalid result", webRequest.getRequest().getInputStream(), result);
}
19
Source : ServletRequestMethodArgumentResolverTests.java
with MIT License
from Vip-Augus
with MIT License
from Vip-Augus
@Test
public void reader() throws Exception {
MethodParameter readerParameter = new MethodParameter(method, 6);
replacedertTrue("Reader not supported", resolver.supportsParameter(readerParameter));
Object result = resolver.resolveArgument(readerParameter, null, webRequest, null);
replacedertSame("Invalid result", webRequest.getRequest().getReader(), result);
}
19
Source : ServletRequestMethodArgumentResolverTests.java
with MIT License
from Vip-Augus
with MIT License
from Vip-Augus
@Test
public void zoneId() throws Exception {
MethodParameter zoneIdParameter = new MethodParameter(method, 9);
replacedertTrue("ZoneId not supported", resolver.supportsParameter(zoneIdParameter));
Object result = resolver.resolveArgument(zoneIdParameter, null, webRequest, null);
replacedertEquals("Invalid result", ZoneId.systemDefault(), result);
}
See More Examples