Package net.pricefx.formulaengine.scripting.inputbuilder


package net.pricefx.formulaengine.scripting.inputbuilder
Builders for logic inputs (user entries and context parameters). Each input type has a builder class, for example SimpleInputBuilder for basic entries, StringInputBuilder for text entries, OptionInputBuilder for option lists, and DateRangeInputBuilder for date ranges. All builders descend from AbstractInputBuilder, whose fluent setters return the concrete builder type so calls can be chained. The same builder classes serve the input mechanisms of the platform: Form logics, the classic "input generation" flow, and configurators.

Form logics (Forms 2.0, since version 17.0): the form binding exposes the same create... factory methods (see FormInputBuilderApi) and an input is finished with AbstractInputBuilder.buildFormInput(). Form logics run without the "input generation" mode; their initial inputs are defined in the init phase instead. Forms are the current mechanism for all new implementations; see the net.pricefx.formulaengine.forms package. The Knowledge Base provides a comparison of the input mechanisms and a step by step guide for converting existing inputs to Forms.

Classic "input generation" flow: the factory is obtained through api.inputBuilderFactory(); see PublicGroovyAPI.inputBuilderFactory(). The returned InputBuilderFactory provides one create... method per input type; a typical flow creates a builder, chains property setters such as setLabel, and finishes with AbstractInputBuilder.getInput(). The behavior of getInput() depends on the execution mode. In the "input generation" mode it registers the input field definition so the user interface can render the field, and returns a random value. In regular execution it returns the value entered by the user; reading the value through the input binding variable is recommended. In configurators and header logics the terminal call is buildContextParameter() instead, because those contexts add the input field through their own structures.

In both flows the first constructor argument is the parameter name, a stable camelCase identifier stored on every line item; use setLabel for the display label.

See Also: