Building a MultiAction

Elliot Ford edited this page Jun 28, 2015 · 2 revisions

What is a MultiAction?

A MultiAction an Action that is built from multiple Actions. This can be used to batch or order Actions that cannot be performed out of sequence. See the API docs for more information about building multi-actions.

What is an ActionOperation?

An ActionOperation is one or a number of Actions combined with an OperationType. The type tells the MultiAction how to deal with the Action(s):

  • PERFORM: the actions will be performed in sequence before proceeding.
  • SCHEDULE: the actions will be scheduled before proceeding.
  • SCHEDULE_AWAIT: the actions will be scheduled and all awaited before proceeding.

Creating the operation is easy: new ActionOperation<>(OperationType.PERFORM, /* Action */)

Building a MultiAction

A MultiAction can be built just as a List can:

MultiAction<?> multi = new MultiAction<>();
multi.add(new ActionOperation<>(OperationType.PERFORM, /* Action */));
multi.add(new ActionOperation<>(OperationType.SCHEDULE, /* Action */));

MultiAction also provides a builder class:

MultiAction<?> multi = new MultiAction.Builder<?>().addPerform(/* Action */).addSchedule(/* Action */).build();

For simple chains there is also: MultiAction.buildChain(/* Actions */)

Clone this wiki locally
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.