本文整理汇总了Java中org.springframework.web.method.support.HandlerMethodArgumentResolver.supportsParameter方法的典型用法代码示例。如果您正苦于以下问题:Java HandlerMethodArgumentResolver.supportsParameter方法的具体用法?Java HandlerMethodArgumentResolver.supportsParameter怎么用?Java HandlerMethodArgumentResolver.supportsParameter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.springframework.web.method.support.HandlerMethodArgumentResolver
的用法示例。
在下文中一共展示了HandlerMethodArgumentResolver.supportsParameter方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: resolveArgument
import org.springframework.web.method.support.HandlerMethodArgumentResolver; //导入方法依赖的package包/类
Object resolveArgument(MethodParameter param, ModelAndViewContainer mav, NativeWebRequest req,
WebDataBinderFactory binder, List<HandlerMethodArgumentResolver> recursiveCallers) throws Exception {
for (HandlerMethodArgumentResolver delegate : delegates) {
if (!recursiveCallers.contains(delegate) && delegate.supportsParameter(param)) {
if (delegate instanceof RecursiveHandlerMethodArgumentResolver) {
return ((RecursiveHandlerMethodArgumentResolver) delegate).resolveArgument(param, mav, req, binder, recursiveCallers);
} else {
return delegate.resolveArgument(param, mav, req, binder);
}
}
}
return null;
}
示例2: supportsParameter
import org.springframework.web.method.support.HandlerMethodArgumentResolver; //导入方法依赖的package包/类
@Override
public boolean supportsParameter(MethodParameter param) {
for (HandlerMethodArgumentResolver delegate : delegates) {
if (delegate.supportsParameter(param)) {
return true;
}
}
return false;
}
示例3: findContextResolver
import org.springframework.web.method.support.HandlerMethodArgumentResolver; //导入方法依赖的package包/类
private Resolution findContextResolver(MethodParameter parameter) {
final Optional<Class> serviceDefinition = Stream.of(((Class) parameter.getContainingClass()).getInterfaces()) //
.filter(c -> AnnotationUtils.findAnnotation(c, Service.class) != null) //
.findFirst();
if (serviceDefinition.isPresent()) {
final Method parameterMethod = parameter.getMethod();
final Method method = ReflectionUtils.findMethod(serviceDefinition.get(), parameterMethod.getName(),
parameterMethod.getParameterTypes());
Resolution resolution = null;
for (HandlerMethodArgumentResolver contextArgumentResolver : getContextArgumentResolvers()) {
if (contextArgumentResolver == this) {
// Prevent stack overflow
continue;
}
final MethodParameter methodParameter = new MethodParameter(parameter) {
@Override
public Method getMethod() {
return method;
}
@Override
public AnnotatedElement getAnnotatedElement() {
return method.getParameters()[parameter.getParameterIndex()];
}
@Override
public Annotation[] getParameterAnnotations() {
return getAnnotatedElement().getAnnotations();
}
};
if (contextArgumentResolver.supportsParameter(methodParameter)) {
resolution = new Resolution(methodParameter, contextArgumentResolver);
break;
}
}
return resolution;
} else {
return null;
}
}