Java Code Examples for org.springframework.web.method.support.InvocableHandlerMethod#setParameterNameDiscoverer()

The following examples show how to use org.springframework.web.method.support.InvocableHandlerMethod#setParameterNameDiscoverer() . 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: RequestMappingHandlerAdapter.java    From spring-analysis-note with MIT License 5 votes vote down vote up
private InvocableHandlerMethod createModelAttributeMethod(WebDataBinderFactory factory, Object bean, Method method) {
	InvocableHandlerMethod attrMethod = new InvocableHandlerMethod(bean, method);
	if (this.argumentResolvers != null) {
		attrMethod.setHandlerMethodArgumentResolvers(this.argumentResolvers);
	}
	attrMethod.setParameterNameDiscoverer(this.parameterNameDiscoverer);
	attrMethod.setDataBinderFactory(factory);
	return attrMethod;
}
 
Example 2
Source File: RequestMappingHandlerAdapter.java    From spring-analysis-note with MIT License 5 votes vote down vote up
private InvocableHandlerMethod createInitBinderMethod(Object bean, Method method) {
	InvocableHandlerMethod binderMethod = new InvocableHandlerMethod(bean, method);
	if (this.initBinderArgumentResolvers != null) {
		binderMethod.setHandlerMethodArgumentResolvers(this.initBinderArgumentResolvers);
	}
	binderMethod.setDataBinderFactory(new DefaultDataBinderFactory(this.webBindingInitializer));
	binderMethod.setParameterNameDiscoverer(this.parameterNameDiscoverer);
	return binderMethod;
}
 
Example 3
Source File: ModelFactoryTests.java    From spring-analysis-note with MIT License 5 votes vote down vote up
private ModelFactory createModelFactory(String methodName, Class<?>... parameterTypes) throws Exception {
	HandlerMethodArgumentResolverComposite resolvers = new HandlerMethodArgumentResolverComposite();
	resolvers.addResolver(new ModelMethodProcessor());

	InvocableHandlerMethod modelMethod = createHandlerMethod(methodName, parameterTypes);
	modelMethod.setHandlerMethodArgumentResolvers(resolvers);
	modelMethod.setDataBinderFactory(null);
	modelMethod.setParameterNameDiscoverer(new LocalVariableTableParameterNameDiscoverer());

	return new ModelFactory(Collections.singletonList(modelMethod), null, this.attributeHandler);
}
 
Example 4
Source File: InitBinderDataBinderFactoryTests.java    From spring-analysis-note with MIT License 5 votes vote down vote up
private WebDataBinderFactory createFactory(String methodName, Class<?>... parameterTypes)
		throws Exception {

	Object handler = new InitBinderHandler();
	Method method = handler.getClass().getMethod(methodName, parameterTypes);

	InvocableHandlerMethod handlerMethod = new InvocableHandlerMethod(handler, method);
	handlerMethod.setHandlerMethodArgumentResolvers(this.argumentResolvers);
	handlerMethod.setDataBinderFactory(new DefaultDataBinderFactory(null));
	handlerMethod.setParameterNameDiscoverer(new LocalVariableTableParameterNameDiscoverer());

	return new InitBinderDataBinderFactory(
			Collections.singletonList(handlerMethod), this.bindingInitializer);
}
 
Example 5
Source File: RequestMappingHandlerAdapter.java    From java-technology-stack with MIT License 5 votes vote down vote up
private InvocableHandlerMethod createModelAttributeMethod(WebDataBinderFactory factory, Object bean, Method method) {
	InvocableHandlerMethod attrMethod = new InvocableHandlerMethod(bean, method);
	if (this.argumentResolvers != null) {
		attrMethod.setHandlerMethodArgumentResolvers(this.argumentResolvers);
	}
	attrMethod.setParameterNameDiscoverer(this.parameterNameDiscoverer);
	attrMethod.setDataBinderFactory(factory);
	return attrMethod;
}
 
Example 6
Source File: RequestMappingHandlerAdapter.java    From java-technology-stack with MIT License 5 votes vote down vote up
private InvocableHandlerMethod createInitBinderMethod(Object bean, Method method) {
	InvocableHandlerMethod binderMethod = new InvocableHandlerMethod(bean, method);
	if (this.initBinderArgumentResolvers != null) {
		binderMethod.setHandlerMethodArgumentResolvers(this.initBinderArgumentResolvers);
	}
	binderMethod.setDataBinderFactory(new DefaultDataBinderFactory(this.webBindingInitializer));
	binderMethod.setParameterNameDiscoverer(this.parameterNameDiscoverer);
	return binderMethod;
}
 
Example 7
Source File: ModelFactoryTests.java    From java-technology-stack with MIT License 5 votes vote down vote up
private ModelFactory createModelFactory(String methodName, Class<?>... parameterTypes) throws Exception {
	HandlerMethodArgumentResolverComposite resolvers = new HandlerMethodArgumentResolverComposite();
	resolvers.addResolver(new ModelMethodProcessor());

	InvocableHandlerMethod modelMethod = createHandlerMethod(methodName, parameterTypes);
	modelMethod.setHandlerMethodArgumentResolvers(resolvers);
	modelMethod.setDataBinderFactory(null);
	modelMethod.setParameterNameDiscoverer(new LocalVariableTableParameterNameDiscoverer());

	return new ModelFactory(Collections.singletonList(modelMethod), null, this.attributeHandler);
}
 
Example 8
Source File: InitBinderDataBinderFactoryTests.java    From java-technology-stack with MIT License 5 votes vote down vote up
private WebDataBinderFactory createFactory(String methodName, Class<?>... parameterTypes)
		throws Exception {

	Object handler = new InitBinderHandler();
	Method method = handler.getClass().getMethod(methodName, parameterTypes);

	InvocableHandlerMethod handlerMethod = new InvocableHandlerMethod(handler, method);
	handlerMethod.setHandlerMethodArgumentResolvers(this.argumentResolvers);
	handlerMethod.setDataBinderFactory(new DefaultDataBinderFactory(null));
	handlerMethod.setParameterNameDiscoverer(new LocalVariableTableParameterNameDiscoverer());

	return new InitBinderDataBinderFactory(
			Collections.singletonList(handlerMethod), this.bindingInitializer);
}
 
Example 9
Source File: RequestMappingHandlerAdapter.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
private InvocableHandlerMethod createModelAttributeMethod(WebDataBinderFactory factory, Object bean, Method method) {
	InvocableHandlerMethod attrMethod = new InvocableHandlerMethod(bean, method);
	attrMethod.setHandlerMethodArgumentResolvers(this.argumentResolvers);
	attrMethod.setParameterNameDiscoverer(this.parameterNameDiscoverer);
	attrMethod.setDataBinderFactory(factory);
	return attrMethod;
}
 
Example 10
Source File: RequestMappingHandlerAdapter.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
private InvocableHandlerMethod createInitBinderMethod(Object bean, Method method) {
	InvocableHandlerMethod binderMethod = new InvocableHandlerMethod(bean, method);
	binderMethod.setHandlerMethodArgumentResolvers(this.initBinderArgumentResolvers);
	binderMethod.setDataBinderFactory(new DefaultDataBinderFactory(this.webBindingInitializer));
	binderMethod.setParameterNameDiscoverer(this.parameterNameDiscoverer);
	return binderMethod;
}
 
Example 11
Source File: RequestMappingHandlerAdapter.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
private InvocableHandlerMethod createModelAttributeMethod(WebDataBinderFactory factory, Object bean, Method method) {
	InvocableHandlerMethod attrMethod = new InvocableHandlerMethod(bean, method);
	attrMethod.setHandlerMethodArgumentResolvers(this.argumentResolvers);
	attrMethod.setParameterNameDiscoverer(this.parameterNameDiscoverer);
	attrMethod.setDataBinderFactory(factory);
	return attrMethod;
}
 
Example 12
Source File: RequestMappingHandlerAdapter.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
private InvocableHandlerMethod createInitBinderMethod(Object bean, Method method) {
	InvocableHandlerMethod binderMethod = new InvocableHandlerMethod(bean, method);
	binderMethod.setHandlerMethodArgumentResolvers(this.initBinderArgumentResolvers);
	binderMethod.setDataBinderFactory(new DefaultDataBinderFactory(this.webBindingInitializer));
	binderMethod.setParameterNameDiscoverer(this.parameterNameDiscoverer);
	return binderMethod;
}
 
Example 13
Source File: ModelFactoryTests.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
private ModelFactory createModelFactory(String methodName, Class<?>... parameterTypes) throws Exception{
	Method method = TestController.class.getMethod(methodName, parameterTypes);

	HandlerMethodArgumentResolverComposite argResolvers = new HandlerMethodArgumentResolverComposite();
	argResolvers.addResolver(new ModelMethodProcessor());

	InvocableHandlerMethod handlerMethod = new InvocableHandlerMethod(this.controller, method);
	handlerMethod.setHandlerMethodArgumentResolvers(argResolvers);
	handlerMethod.setDataBinderFactory(null);
	handlerMethod.setParameterNameDiscoverer(new LocalVariableTableParameterNameDiscoverer());

	return new ModelFactory(Arrays.asList(handlerMethod), null, this.sessionAttrsHandler);
}
 
Example 14
Source File: InitBinderDataBinderFactoryTests.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
private WebDataBinderFactory createBinderFactory(String methodName, Class<?>... parameterTypes)
		throws Exception {

	Object handler = new InitBinderHandler();
	Method method = handler.getClass().getMethod(methodName, parameterTypes);

	InvocableHandlerMethod handlerMethod = new InvocableHandlerMethod(handler, method);
	handlerMethod.setHandlerMethodArgumentResolvers(argumentResolvers);
	handlerMethod.setDataBinderFactory(new DefaultDataBinderFactory(null));
	handlerMethod.setParameterNameDiscoverer(new LocalVariableTableParameterNameDiscoverer());

	return new InitBinderDataBinderFactory(Arrays.asList(handlerMethod), bindingInitializer);
}