public interface FieldConstraint
Modifier and Type | Method and Description |
---|---|
static FieldConstraint |
add(FieldConstraint a,
FieldConstraint b)
Merge two
FieldConstraint s
values can be null |
<I extends Input> |
apply(boolean support_multi_stage,
java.lang.String field,
Selector<I> original,
Form form,
java.util.HashMap fixtures)
Mutate a
Selector based on other form fields. |
<I extends Input> Selector<I> apply(boolean support_multi_stage, java.lang.String field, Selector<I> original, Form form, java.util.HashMap fixtures)
Selector
based on other form fields.
Normally this requires the value of the input to have a fixed value
e.g. an UnmodifiableInput
, a ListInput
with a single valid option or a suppressed field.
If the prerequisite fields are not fixed or not present then this method can return null
to request an additional form stage be introduced. The form builder should then retry this
field in subsequent stages (where previous fields will be locked). Fixed values are copied into the
fixtures map. This also can contain values for supressed fields. Care needs to be taken with pre-requisites that
are optional.
Ideally if support_multi_stage is false the method should add a corresponding FormValidator
to the form instead and return
the original Selector
I
- type of Input
support_multi_stage
- Does surrounding context support multi-stagefield
- Field that Selector is fororiginal
- Selector
form
- Form
being built.fixtures
- HashMap
of fixed field data. This can include supressed fields. note values of optional fields may be null.Selector
or null to request an additional form stage.static FieldConstraint add(FieldConstraint a, FieldConstraint b)
FieldConstraint
s
values can be nulla
- b
-