Replace ModelAndViewContainer parameter with Object
This commit is contained in:
@@ -160,10 +160,10 @@ public class ModelAttributeMethodProcessor
|
||||
return returnType.getMethodAnnotation(ModelAttribute.class) != null;
|
||||
}
|
||||
|
||||
public <V> void handleReturnValue(Object returnValue,
|
||||
MethodParameter returnType,
|
||||
ModelAndViewContainer<V> mavContainer,
|
||||
NativeWebRequest webRequest) throws Exception {
|
||||
public void handleReturnValue(Object returnValue,
|
||||
MethodParameter returnType,
|
||||
ModelAndViewContainer mavContainer,
|
||||
NativeWebRequest webRequest) throws Exception {
|
||||
String name = ModelFactory.getNameForReturnValue(returnValue, returnType);
|
||||
mavContainer.addModelAttribute(name, returnValue);
|
||||
}
|
||||
|
||||
@@ -70,10 +70,10 @@ public class ModelMethodProcessor implements HandlerMethodArgumentResolver, Hand
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
public <V> void handleReturnValue(Object returnValue,
|
||||
MethodParameter returnType,
|
||||
ModelAndViewContainer<V> mavContainer,
|
||||
NativeWebRequest webRequest) throws Exception {
|
||||
public void handleReturnValue(Object returnValue,
|
||||
MethodParameter returnType,
|
||||
ModelAndViewContainer mavContainer,
|
||||
NativeWebRequest webRequest) throws Exception {
|
||||
if (returnValue instanceof Model) {
|
||||
mavContainer.addModelAttributes((Model) returnValue);
|
||||
}
|
||||
|
||||
@@ -46,9 +46,9 @@ public interface HandlerMethodReturnValueHandler extends HandlerMethodProcessor
|
||||
* @param webRequest the current request
|
||||
* @throws Exception in case of errors
|
||||
*/
|
||||
<V> void handleReturnValue(Object returnValue,
|
||||
MethodParameter returnType,
|
||||
ModelAndViewContainer<V> mavContainer,
|
||||
NativeWebRequest webRequest) throws Exception;
|
||||
void handleReturnValue(Object returnValue,
|
||||
MethodParameter returnType,
|
||||
ModelAndViewContainer mavContainer,
|
||||
NativeWebRequest webRequest) throws Exception;
|
||||
|
||||
}
|
||||
@@ -57,10 +57,10 @@ public class HandlerMethodReturnValueHandlerContainer implements HandlerMethodRe
|
||||
* Handles the given method return value by iterating over registered {@link HandlerMethodReturnValueHandler}s
|
||||
* to find one that supports it.
|
||||
*/
|
||||
public <V> void handleReturnValue(Object returnValue,
|
||||
MethodParameter returnType,
|
||||
ModelAndViewContainer<V> mavContainer,
|
||||
NativeWebRequest webRequest) throws Exception {
|
||||
public void handleReturnValue(Object returnValue,
|
||||
MethodParameter returnType,
|
||||
ModelAndViewContainer mavContainer,
|
||||
NativeWebRequest webRequest) throws Exception {
|
||||
HandlerMethodReturnValueHandler handler = getReturnValueHandler(returnType);
|
||||
if (handler != null) {
|
||||
handler.handleReturnValue(returnValue, returnType, mavContainer, webRequest);
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
package org.springframework.web.method.support;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.Arrays;
|
||||
@@ -201,7 +202,8 @@ public class InvocableHandlerMethod extends HandlerMethod {
|
||||
if (args != null && args.length > 0) {
|
||||
builder.append(" and argument types ");
|
||||
for (int i = 0; i < args.length; i++) {
|
||||
builder.append(" : arg[").append(i).append("] ").append(args[i].getClass());
|
||||
String argClass = (args[i] != null) ? args[i].getClass().toString() : "null";
|
||||
builder.append(" : arg[").append(i).append("] ").append(argClass);
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -31,14 +31,12 @@ import org.springframework.ui.ModelMap;
|
||||
*
|
||||
* @author Rossen Stoyanchev
|
||||
* @since 3.1
|
||||
*
|
||||
* @param <V> Servlet or Portlet specific View type.
|
||||
*/
|
||||
public class ModelAndViewContainer<V> {
|
||||
public class ModelAndViewContainer {
|
||||
|
||||
private String viewName;
|
||||
|
||||
private V view;
|
||||
private Object view;
|
||||
|
||||
private final ModelMap actualModel = new ExtendedModelMap();
|
||||
|
||||
@@ -60,11 +58,11 @@ public class ModelAndViewContainer<V> {
|
||||
this.viewName = viewName;
|
||||
}
|
||||
|
||||
public V getView() {
|
||||
public Object getView() {
|
||||
return this.view;
|
||||
}
|
||||
|
||||
public void setView(V view) {
|
||||
public void setView(Object view) {
|
||||
this.view = view;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user