Builder

@ApiStatus.Experimental
class Builder

Collects the questions of a decision spec in declared order. Get one from DecisionSpec.builder.

Each declaring method either adds exactly one question or leaves the builder as it was. When a method throws, nothing is added. Each call to build returns a new spec, and later declarations do not affect specs already built. A builder is not safe for use from several threads at once.

Functions

Link copied to clipboard

Returns a new spec holding the questions declared so far. The builder can keep declaring questions afterwards.

Link copied to clipboard

Declares a choice question. The customizer receives a new builder that already carries the name, and must call asking(...) and add at least one option. The customizer runs once, before this method returns, and its exceptions pass through unchanged. It does not run when the name is blank or already used.

Link copied to clipboard

Declares a proposition question. The customizer receives a new builder that already carries the name, and must at least call asking(...) on it. The customizer runs once, before this method returns, and its exceptions pass through unchanged. It does not run when the name is blank or already used.

Link copied to clipboard

Adds a question that was built earlier, for example with Questions.named(...).

Link copied to clipboard

Declares a rating question. The customizer receives a new builder that already carries the name, and must call asking(...) and add at least two levels, lowest first. The customizer runs once, before this method returns, and its exceptions pass through unchanged. It does not run when the name is blank or already used.