|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.speakright.core.ModelBinder
public class ModelBinder
ModelBinder binds user input to values in the model. When a flow object executes it can add bindings for slots in the SML that the speech platform will return. If the speech platform returns user input, the bindings are used to assign the user input data to values(s) in the model.
For example, a flow might ask the user for a city name, and tell SpeakRight to bind the SML slot "city" to the model value City (that is, M.City()).
| Field Summary | |
|---|---|
java.util.ArrayList |
m_L
|
IModel |
m_model
|
| Constructor Summary | |
|---|---|
ModelBinder()
used for serialization |
|
ModelBinder(IModel m)
Constructor |
|
| Method Summary | |
|---|---|
void |
addBinding(IFlow flow,
java.lang.String slotName,
java.lang.String propName)
adds a binding. |
void |
bind(IFlow current,
SRResults results)
Looks for and applies any data binding. |
boolean |
failed(SRError parent)
extracts any errors that the model binder logged. |
java.util.ArrayList |
getBindings()
Gets list of BindingSpec objects. |
IModel |
getModel()
Get the model object. |
java.lang.String |
getModelValue(java.lang.String modelVar)
Get the value of the given model variable. |
void |
injectModel(IFlow flow)
A type-agnostic way to assign a model to a flow object. |
void |
setBindings(java.util.ArrayList bindingL)
Sets list of BindingSpec objects. |
void |
setModel(IModel model)
Set the model object. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public IModel m_model
public java.util.ArrayList m_L
| Constructor Detail |
|---|
public ModelBinder(IModel m)
m - the application's model object.public ModelBinder()
| Method Detail |
|---|
public boolean failed(SRError parent)
IModelBinder
failed in interface IModelBinderparent - error object to copy error info into.
public IModel getModel()
IModelBinder
getModel in interface IModelBinderpublic void setModel(IModel model)
IModelBinder
setModel in interface IModelBindermodel - the application instance's modelpublic void injectModel(IFlow flow)
The injection is not done until the flow is executed. Flow objects must only reference their M field from within getFirst, getNext, execute, or an event handler.
injectModel uses reflection to find and assign to M. This frees SpeakRight from having to know about the application-defined Model class.
injectModel in interface IModelBinderflow - the flow to inject the model into.
public void addBinding(IFlow flow,
java.lang.String slotName,
java.lang.String propName)
addBinding in interface IModelBinderflow - the flow object currently executing.slotName - the SML slot name that will contain the user input value to be boundpropName - the model property name to bind the data to.
public void bind(IFlow current,
SRResults results)
bind in interface IModelBindercurrent - the flow whose results are in resultsresults - the results from executing current's VoiceXML page.public java.lang.String getModelValue(java.lang.String modelVar)
getModelValue in interface IModelBindermodelVar - name of the model variable (eg. "city")
public java.util.ArrayList getBindings()
getBindings in interface IModelBinderpublic void setBindings(java.util.ArrayList bindingL)
setBindings in interface IModelBinder
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||