Skip to content

Instantly share code, notes, and snippets.

@wfaler
Created October 17, 2012 14:30
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save wfaler/3905823 to your computer and use it in GitHub Desktop.
Save wfaler/3905823 to your computer and use it in GitHub Desktop.
ModelAndViewWTF.java
// WTF's added by me, class cut down for brevity.
public class ModelAndView {
// WTF?!
/** View instance or view name String */
private Object view;
public ModelAndView(String viewName) {
this.view = viewName;
}
public ModelAndView(View view) {
this.view = view;
}
// WTF?!
/**
* Return the view name to be resolved by the DispatcherServlet
* via a ViewResolver, or <code>null</code> if we are using a View object.
*/
public String getViewName() {
return (this.view instanceof String ? (String) this.view : null);
}
// WTF?!
/**
* Return the View object, or <code>null</code> if we are using a view name
* to be resolved by the DispatcherServlet via a ViewResolver.
*/
public View getView() {
return (this.view instanceof View ? (View) this.view : null);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment