Trigger Controller
Any instance of Trap works as a trigger controller.
Basically, we use trigger controllers to find trigger handlers.
TriggerHandler handler = Trap.getInstance().find('Case');This, by default, will find the trigger handler named CaseTrigger. If the trigger controller fails to find an existing instance of CaseTrigger, it will create one and store it. Otherwise it will load the existing one.
We can alter the default naming convention like this:
TriggerHandler handler = Trap.getInstance('Handler').find('Case');In this way, the trigger controller will look for CaseHandler instead of the default CaseTrigger.
Methods are like:
| Method | Description |
|---|---|
| Trap.TriggerHandler find(String) | Find the trigger handler |
| void start() | Start the trigger controller with default values from real trigger context |
| void start(Trap.Event, List | Start the trigger controller with given values |