Replace relevant code with lambda
See gh-1454
This commit is contained in:
@@ -470,13 +470,10 @@ public class MvcUriComponentsBuilder {
|
||||
}
|
||||
|
||||
private static Method getMethod(Class<?> controllerType, final String methodName, final Object... args) {
|
||||
MethodFilter selector = new MethodFilter() {
|
||||
@Override
|
||||
public boolean matches(Method method) {
|
||||
String name = method.getName();
|
||||
int argLength = method.getParameterCount();
|
||||
return (name.equals(methodName) && argLength == args.length);
|
||||
}
|
||||
MethodFilter selector = method -> {
|
||||
String name = method.getName();
|
||||
int argLength = method.getParameterCount();
|
||||
return (name.equals(methodName) && argLength == args.length);
|
||||
};
|
||||
Set<Method> methods = MethodIntrospector.selectMethods(controllerType, selector);
|
||||
if (methods.size() == 1) {
|
||||
|
||||
@@ -117,6 +117,19 @@ import org.springframework.web.util.WebUtils;
|
||||
public class RequestMappingHandlerAdapter extends AbstractHandlerMethodAdapter
|
||||
implements BeanFactoryAware, InitializingBean {
|
||||
|
||||
/**
|
||||
* MethodFilter that matches {@link InitBinder @InitBinder} methods.
|
||||
*/
|
||||
public static final MethodFilter INIT_BINDER_METHODS =
|
||||
method -> AnnotationUtils.findAnnotation(method, InitBinder.class) != null;
|
||||
|
||||
/**
|
||||
* MethodFilter that matches {@link ModelAttribute @ModelAttribute} methods.
|
||||
*/
|
||||
public static final MethodFilter MODEL_ATTRIBUTE_METHODS =
|
||||
method -> ((AnnotationUtils.findAnnotation(method, RequestMapping.class) == null)
|
||||
&& (AnnotationUtils.findAnnotation(method, ModelAttribute.class) != null));
|
||||
|
||||
private List<HandlerMethodArgumentResolver> customArgumentResolvers;
|
||||
|
||||
private HandlerMethodArgumentResolverComposite argumentResolvers;
|
||||
@@ -981,26 +994,4 @@ public class RequestMappingHandlerAdapter extends AbstractHandlerMethodAdapter
|
||||
return mav;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* MethodFilter that matches {@link InitBinder @InitBinder} methods.
|
||||
*/
|
||||
public static final MethodFilter INIT_BINDER_METHODS = new MethodFilter() {
|
||||
@Override
|
||||
public boolean matches(Method method) {
|
||||
return AnnotationUtils.findAnnotation(method, InitBinder.class) != null;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* MethodFilter that matches {@link ModelAttribute @ModelAttribute} methods.
|
||||
*/
|
||||
public static final MethodFilter MODEL_ATTRIBUTE_METHODS = new MethodFilter() {
|
||||
@Override
|
||||
public boolean matches(Method method) {
|
||||
return ((AnnotationUtils.findAnnotation(method, RequestMapping.class) == null) &&
|
||||
(AnnotationUtils.findAnnotation(method, ModelAttribute.class) != null));
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user