Builder interface used to build a flow definition. The process of building a flow consists of the following steps:
- Initialize this builder, creating the initial flow definition, by calling {@link #init(FlowBuilderContext)}.
- Call {@link #buildVariables()} to create any variables of the flow and add them to the flow definition.
- Call {@link #buildInputMapper()} to create and set the input mapper for the flow.
- Call {@link #buildStartActions()} to create and add any start actions to the flow.
- Call {@link #buildStates()} to create the states of the flow and add them to the flow definition.
- Call {@link #buildGlobalTransitions()} to create any transitions shared by all states of the flow and add them tothe flow definition.
- Call {@link #buildEndActions()} to create and add any end actions to the flow.
- Call {@link #buildOutputMapper()} to create and set the output mapper for the flow.
- Call {@link #buildExceptionHandlers()} to create the exception handlers of the flow and add them to the flowdefinition.
- Call {@link #getFlow()} to return the fully-built {@link Flow} definition.
- Dispose this builder, releasing any resources allocated during the building process by calling {@link #dispose()}.
Implementations should encapsulate flow construction logic, either for a specific kind of flow, for example, an OrderFlowBuilder
built in Java code, or a generic flow builder strategy, like the XmlFlowBuilder
, for building flows from an XML-definition.
Flow builders are used by the {@link FlowAssembler}, which acts as an assembler (director). Flow Builders may be reused, however, exercise caution when doing this as these objects are not thread safe. Also, for each use be sure to call init, followed by the build* methods, getFlow, and dispose completely in that order.
This is a good example of the classic GoF builder pattern.
@see Flow
@see FlowBuilderContext
@see FlowAssembler
@author Keith Donald
@author Erwin Vervaet