Event actions
An event action is a subprogram or function that is associated with the event definition. It can be invoked or called from any monitor or from another action in the same event. Like monitor actions, the caller must supply actual parameters of the same type and number as the event action’s formal parameters and if the action returns a value, then the return value must be consumed by the caller.
Unlike monitor actions (see
Monitor actions), events do not have the special actions
onload(),
onunload(), and
ondie().
EventActionDef
Event action formal parameters
Event action FormalParameters is a comma-separated list of ParameterDefinitions, enclosed in parentheses.
FormalParameters
Rule components
The FormalParameters is a comma-separated list of ParameterDefinitions, enclosed in parentheses. A parameter definition consists of a type name and an identifier. The identifier is the name of a parameter variable which will be bound to a copy of the value of an expression specified by the caller (that is, the value passed by the caller) when the action is invoked. The number and type of actual parameter values passed by a caller must match those listed in the action’s formal parameters.
The scope of a parameter variable is the statement or block that forms the action body. Parameter variables are very similar to an action’s local variables.
Event action return value
An event action return value specifies the return value type.
ReturnValue
Rule components
If the event action definition includes a returns clause, then the action returns a value of the specified type. All control paths within the action body must lead to a return statement before the end of the action body.
Event action body
The block construct forms the event action body. All variable references within an event action body must be one of the following:
A field of the event
A formal parameter of the action
A local variable defined in the action body