Skip to content

Instantly share code, notes, and snippets.

@kchien
Forked from wfaler/ModelAndViewWTF.java
Last active August 29, 2015 14:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kchien/e4182696645326949750 to your computer and use it in GitHub Desktop.
Save kchien/e4182696645326949750 to your computer and use it in GitHub Desktop.
// 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