5.4. Action outcome event mappings
Prev | 5. Executing actions | Next

## 5.4. Action outcome event mappings

Actions often invoke methods on plain Java objects. When called from action-states and decision-states, these method return values can be used to drive state transitions. Since transitions are triggered by events, a method return value must first be mapped to an Event object. The following table describes how common return value types are mapped to Event objects:

Table 5.1. Action method return value to event id mappings

Method return type | Mapped Event identifier expression
--- | ---
java.lang.String | the String value
java.lang.Boolean | yes (for true), no (for false)
java.lang.Enum | the Enum name
any other type | success

This is illustrated in the example action state below, which invokes a method that returns a boolean value:

    <action-state id="moreAnswersNeeded">
        <evaluate expression="interview.moreAnswersNeeded()" />
        <transition on="yes" to="answerQuestions" />
        <transition on="no" to="finish" />
    </action-state>

Prev | Up | Next
5.3. Defining decision states | Home | 5.5. Action implementations