initial BindingLifecycle @MVC integration

This commit is contained in:
Keith Donald
2009-07-30 11:18:39 +00:00
parent 44cf4e207a
commit e020b5752a
15 changed files with 891 additions and 8 deletions

View File

@@ -39,9 +39,10 @@ public class MvcBindingLifecycle implements BindingLifecycle<Object> {
private Object model;
private PresentationModel presentationModel;
public MvcBindingLifecycle(Class<?> modelType, PresentationModelFactory presentationModelFactory,
ModelMap modelMap, Map<String, ? extends Object> fieldValues) {
this.modelType = modelType;
this.presentationModelFactory = presentationModelFactory;
this.modelMap = modelMap;
this.fieldValues = fieldValues;
@@ -78,6 +79,10 @@ public class MvcBindingLifecycle implements BindingLifecycle<Object> {
private void initModel() {
try {
if (modelType == null) {
throw new IllegalStateException("Unable to create new model to bind to, no modelType was specified - "
+ "did you parameterize the model <M> for your BindingLifecycle declaration?");
}
model = modelType.newInstance();
} catch (InstantiationException e) {
throw new IllegalStateException("Model of type [" + modelType.getName()