public class StepResult<T> extends Result
StepLayout
to hold all child results of type T
produced by the step.
A step result is typically generated by the framework as the task proceeds. When the task completes, it may be appropriate to serialize it for transmission to a server, or to immediately perform analysis on it.
For example, an QuestionStep
object produces a result of type T
that becomes
a child of the StepResult
object.
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
DEFAULT_KEY
When StepResult only has a single value, pair that value with the following key
|
Constructor and Description |
---|
StepResult(Step step)
Creates a StepResult from a
Step . |
Modifier and Type | Method and Description |
---|---|
AnswerFormat |
getAnswerFormat()
Gets the
AnswerFormat for this step result. |
T |
getResult()
Returns the result stored using
setResult(T) . |
T |
getResultForIdentifier(java.lang.String identifier)
Returns the result for the given identifier, use this when there are multiple results for the
step.
|
java.util.Map<java.lang.String,T> |
getResults() |
void |
setResult(T result)
Sets the result using the default key, useful when there is only a single result.
|
void |
setResultForIdentifier(java.lang.String identifier,
T result)
Sets the result for the given identifier, use when there are multiple results for the step.
|
void |
setResults(java.util.Map<java.lang.String,T> results) |
getEndDate, getIdentifier, getStartDate, setEndDate, setStartDate
public static final java.lang.String DEFAULT_KEY
public java.util.Map<java.lang.String,T> getResults()
public void setResults(java.util.Map<java.lang.String,T> results)
public T getResult()
setResult(T)
.public void setResult(T result)
result
- the result to save with the default keypublic T getResultForIdentifier(java.lang.String identifier)
identifier
- the identifier used as the key for storing this resultpublic void setResultForIdentifier(java.lang.String identifier, T result)
If there is only one result, use the setResult(T)
convenience method instead.
identifier
- the identifier for the resultresult
- the result to savepublic AnswerFormat getAnswerFormat()
AnswerFormat
for this step result. May be useful when processing the
result.