public class MultiFieldConstraint extends java.util.LinkedHashSet<FieldConstraint> implements FieldConstraint
FieldConstraint
. The constaints are added in order![]() |
![]() |
Constructor and Description |
---|
MultiFieldConstraint(FieldConstraint... constraints) |
Modifier and Type | Method and Description |
---|---|
boolean |
add(FieldConstraint e) |
<I extends Input> |
apply(boolean support_multi_stage,
java.lang.String field,
Selector<I> sel,
Form form,
java.util.HashMap fixtures)
Mutate a
Selector based on other form fields. |
clear, clone, contains, isEmpty, iterator, remove, size
addAll, containsAll, retainAll, toArray, toArray, toString
finalize, getClass, notify, notifyAll, wait, wait, wait
add
public MultiFieldConstraint(FieldConstraint... constraints)
public boolean add(FieldConstraint e)
add
in interface java.util.Collection<FieldConstraint>
add
in interface java.util.Set<FieldConstraint>
add
in class java.util.HashSet<FieldConstraint>
public <I extends Input> Selector<I> apply(boolean support_multi_stage, java.lang.String field, Selector<I> sel, Form form, java.util.HashMap fixtures)
FieldConstraint
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
apply
in interface FieldConstraint
I
- type of Input
support_multi_stage
- Does surrounding context support multi-stagefield
- Field that Selector is forsel
- 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.