本文整理匯總了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;
}
}