com.talk2object.plum.interaction.session.SessionConfig Maven / Gradle / Ivy
package com.talk2object.plum.interaction.session;
public class SessionConfig {
private String modelClassName;
private Object model;
public SessionConfig(String modelClassName) {
this.modelClassName = modelClassName;
}
/**
* use model to create view for the session.
*
* @param model
*/
public SessionConfig(Object model) {
this.model = model;
}
public String getModelClassName() {
return modelClassName;
}
public void setModelClassName(String modelClassName) {
this.modelClassName = modelClassName;
}
public Object getModel() {
return model;
}
public Object getModel(boolean autoCreate) {
if (model == null && autoCreate) {
try {
Class defaultModelClass = Class.forName(modelClassName);
model = defaultModelClass.newInstance();
} catch (Exception e) {
throw new RuntimeException(e);
}
}
return model;
}
public void setModel(Object model) {
this.model = model;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy