Decision Projection
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]Content copied to clipboard
Parameters
T
the caller's target type