![JAR search and dependency download from the Maven repository](/logo.png)
sardine.mvc.ModelAndView Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of sardine Show documentation
Show all versions of sardine Show documentation
lightweight framework for creating small standalone java applications in a micro service way.
The newest version!
package sardine.mvc;
import java.util.HashMap;
import java.util.Map;
/**
* @author bruce-sha
* 2015/6/15
*/
public class ModelAndView {
/**
* Model object.
*/
private Map model;
/**
* View name used to render output.
*/
private String viewName;
/**
* Constructs an instance with the provided model and view name
*
* model the model
* viewName the view name
*/
public ModelAndView(Map model, String viewName) {
this.model = model;
this.viewName = viewName;
}
/**
* @return the model object
*/
public Map getModel() {
return model;
}
/**
* @return the view name
*/
public String getViewName() {
return viewName;
}
public static ModelAndView view(String viewName) {
return new ModelAndView(new HashMap(), viewName);
}
public ModelAndView model(String modelName, Object modelObject) {
if (model == null) model = new HashMap();
model.put(modelName, modelObject);
return this;
}
public ModelAndView models(Map anModel) {
if (model == null) model = new HashMap();
model.putAll(anModel);
return this;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy