DecisionProjection

@ApiStatus.Experimental
class DecisionProjection<T : Any>

A caller-owned value read out of a decision response, kept together with the response it came from. Build one with one of the of overloads, which read the response's answered values and convert them to the target type with Jackson. The default mapper fails when a constructor parameter of the target has no answered value, so a record component with no matching question is an error. A mapper passed in keeps its own settings.

For a spec with an is_urgent proposition and a department choice, a record whose component names match the question names receives the answers:

record SupportRoute(boolean is_urgent, String department) {}

var route = DecisionProjection.of(response, SupportRoute.class).getValue();
// SupportRoute[is_urgent=true, department=billing]

Parameters

T

the caller's target type

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

the response the value was read from, unchanged

Link copied to clipboard
val value: T

the projected value

Functions

Link copied to clipboard
open override fun toString(): String