Annotation Interface AbstractFieldBuilder.Binding
- Enclosing class:
- AbstractFieldBuilder<S extends AbstractFieldBuilder<S,
T>, T>
Binder
binding itself.
Properties correspond to methods in Binder.BindingBuilder
.
Note: When it comes to Converter
s, Validator
s, and nullRepresentation()
,
the order in which these items are added to the binding matters. These items are chained together in sequence
between the field and the model.
For example, the standard Binder.BindingBuilder
methods such as
withConverter()
always add new items to the "model" side
of the chain, so that (for example) each Converter
added will take as its "presentation" value the previous
Converter
's "model" value.
This annotation builds the binding by applying its configuration in the following order, going from the field's presentation value to the data bean's model value:
- Implicit validation by
ValidatingField
s requiredValidator()
,requiredProvider()
, orrequired()
nullRepresentation()
converter()
validators()
(in the order given)postValidationConverter()
Therefore, each item in the list should assume all previous items in list have already "seen" the field's value.
In particular, if both a converter()
and one or more validators()
are configured, then the
Validator
s will validate the converted model values, not the presentation values.
To get the reverse behavior, i.e., to validate presentation values instead of model values, configure the
Converter
using postValidationConverter()
instead of converter()
.
- See Also:
-
Optional Element Summary
Modifier and TypeOptional ElementDescriptionGet the converter class to be applied before anyvalidators()
are applied.Get the null representation.Get the converter class to be applied after anyvalidators()
are applied.Get "as required" error message.Class<? extends ErrorMessageProvider>
Get "as required" error message provider class.Get "as required" validator class.Class<? extends BindingValidationStatusHandler>
Get the validation status handler class.Get the validator class(es).
-
Element Details
-
required
String requiredGet "as required" error message.Only one of this property,
requiredProvider()
, orrequiredValidator()
should be set.- Returns:
- "as required" error message
- See Also:
- Default:
- ""
-
requiredProvider
Class<? extends ErrorMessageProvider> requiredProviderGet "as required" error message provider class.Only one of this property,
required()
, orrequiredValidator()
should be set.- Returns:
- "as required" error message provider class
- See Also:
- Default:
- com.vaadin.flow.data.binder.ErrorMessageProvider.class
-
requiredValidator
Get "as required" validator class.Only one of this property,
required()
, orrequiredProvider()
should be set.- Returns:
- "as required" error message provider class
- See Also:
- Default:
- com.vaadin.flow.data.binder.Validator.class
-
converter
Get the converter class to be applied before anyvalidators()
are applied.- Returns:
- converter class
- See Also:
- Default:
- com.vaadin.flow.data.converter.Converter.class
-
postValidationConverter
Get the converter class to be applied after anyvalidators()
are applied.- Returns:
- converter class
- See Also:
- Default:
- com.vaadin.flow.data.converter.Converter.class
-
nullRepresentation
String nullRepresentationGet the null representation.This property only works for fields that represent a
String
value, such asTextField
.Note: Do not combine this with
@FieldBuilder.NullifyCheckbox
orNullableField
. That would mean theNullableField
could never be set to null, which defeats its purpose.Note: the default value is just a placeholder, indicating that no null representation should be configured.
- Returns:
- null representation
- See Also:
- Default:
- "<FieldBuilderStringDefault>"
-
validationStatusHandler
Class<? extends BindingValidationStatusHandler> validationStatusHandlerGet the validation status handler class.- Returns:
- validation status handler class
- See Also:
- Default:
- com.vaadin.flow.data.binder.BindingValidationStatusHandler.class
-
validators
Get the validator class(es).- Returns:
- zero or more validator classes
- See Also:
- Default:
- {}
-